Latest Articles

Our latest news updates and insightful blog posts, designed to empower you with the knowledge and strategies you need to succeed.

To install a module in Drupal 10 using Composer

Open a terminal and go to the root directory of your Drupal project.cd /path/to/your/drupal-projectUse the following Composer command to download the module:composer require drupal/module_nameReplace module_name with the actual machine name of the module. For example, to install the Pathauto module:composer require drupal/pathautoThis will download the module and place it inside the web/modules/contrib/ directory.After installation, clear the cache to ensure Drupal recognizes the new module:If D…

Theming drupal commerce product page in Drupal 10

Theming a Drupal Commerce product page involves customizing the Twig templates, CSS, and possibly preprocess functions to control the look and feel of the product display. Here’s a structured approach:Identify the Template to OverrideDrupal uses Twig templates to render product pages. The most relevant template for product pages is: commerce-product--[product-type].html.twig  If your product type is "t-shirt", the template would be:commerce-product--t-shirt.html.twigThe generic fallbac…

Templates Example and Template Name Drupal 8 and 9

Drupal loads templates based on certain naming conventions. This allows you to override templates by adding them to your theme and giving them specific names.HTML Template for Head TagThe HTML template provides markup for the basic structure of the HTML-page including the ,and tags.Base template: html.html.twig (base location: core/modules/system/templates/html.html.twig)Examplehtml--[internalviewpath].html.twig html--node--[nodeid].html.twig html.html.twig

Successful Drupal Websites Around the World

For over 20 years, Drupal, the open-source content management system (CMS), has formed the foundation for building powerful, scalable, and flexible website solutions. Flexible in nature, Drupal supports websites for governments, schools, non-profits, and enterprises across the globe. This article takes a look at some of the most popular Drupal sites across the globe and how well this excellent platform has been utilized.1. The White House (USA)White House, The Official Website of the President o…

Step to Configure Gmail Id in Microsoft Outlook

Go to Gmail from your browser, then select the Google apps icon in the upper right corner of the screen.Select your account.  On the left, select Security. Under Signing into Google, if 2-Step Verification is OFF, click the>next to OFF to turn it ON. Otherwise, skip to step 4.   On the first screen, click CONTINUE.   If prompted, enter your Gmail password and then click NEXT.   Enter your phone number and select whether you want to receive your verification codes…

Show Related Content by Category Using Views Drupal 8 or 9

Follow these step to make block using views to show the related content according to category of the current content page.Edit the views and open Advance sectionAdd the  'Content: Has taxonomy term ID' in CONTEXTUAL FILTERS.Check 'Provide default value' option and then select the 'Taxonomy term ID from URL'. 3.     Check the 'Load default filter from node page, that's good for related taxonomy blocks' option.4.     Check the 'Limit terms by vocab…

Set default value user name in user login form using form alter drupal 8

To set a default value for the username field in a user login form using a form alter hook in Drupal 8, you can use the following code:/** * Implements hook_form_alter(). */ function yourmodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if ($form_id === 'user_login_form') { // Set the default value for the username field. $form['name']['#default_value'] = 'your_default_username'; } } Replace 'yourmodule' with the actual name of your custom…

Set current date in custom form element in DRUPAL8

Set current date in custom form element in DRUPAL8Add this line at top use Drupal\Core\Datetime\DrupalDateTime; Add the following code to your formfunction HOOK_form_alter(&$form, FormStateInterface $form_state, $form_id) { if ($form_id == 'node_article_form') { $form['field_date']['widget'] = array( '#type' => 'datetime', '#title' => 'Enter Date', '#required' => TRUE, '#default_value' => DrupalDateTime::createFromTimestamp(time()), );…

Select Query to get users of empty fields

Select those users which name (Custom field) is emptyIn the following I have created a custom field (name) in user profile, field machine name as field_nameI want get user list where name field is blank $uids = \Drupal::entityQuery('user') ->condition('field_name', NULL, 'IS NULL') ->execute(); echo count($uids); If you want to get more user through user idforeach($uids as $uid){ $users = User::load($uid); $users->get('name')->value; }

Return error on Zoom API with custom_questions in Drupal 8

Prob:in Drupal 8 I have created custom code to post data in Zoom using ZOOM API.I have added custom question in Zoom Dashboard as belowZoom API was working but when I added a custom question in Event then is showing an error as below"[code] => 300 [message] => The parameter is required in custom_questions: Referred By." Soln:If you added a custom question then you have to pass their title and value in parameter, example below. Label of question in title and value in answerFollowing co…

Render Field Variable In Node Twig Template (Node.html.twig) Drupal 8

Render Field Variable In Node Twig Template (Node.html.twig) Drupal 8Show Node Created DateIf you want to show node created date on template you can use code as below{{ node.getCreatedTime|date("d/m/Y")}}You change date format as your requirementDisplay Title of node{{ node.title.value }}Print node url{{ url }}Show Term Reference FieldTo display reference term name the you can use code as below{{ node.field_company_name.entity.name.value}}In example "company_name" is term reference type field in…

Redirect website to HTTPS Drupal

Forcely redirect the website URL to SSLIf your website is opening with both form With HTTPS and without HTTPS but you want to redirect URL to with HTTPS URL then following step you can use. I have applied this method in Drupal 8 and Drupal 9 websiteIf SSL enabled in your website then you can use following code in htaccess file# Redirect to HTTPS RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]