Latest Articles
Our latest news updates and insightful blog posts, designed to empower you with the knowledge and strategies you need to succeed.
What is the purpose of Ctools in Drupal 9
In Drupal 9, Ctools (Chaos tools) is a suite of developer tools and APIs that provide various functionalities to enhance and simplify module development. Ctools is not specific to Drupal 9 and has been widely used in previous versions as well.
The primary purpose of Ctools is to provide a set of reusable utilities and APIs that help developers build complex and interactive features in Drupal. Some of the key features and purposes of Ctools in Drupal 9 include:
- Plugin system:…
What are the benefits of using Drupal
Drupal is a powerful and flexible open-source content management system (CMS) that offers numerous benefits for website development and management. Here are some of the key benefits of using Drupal:
- Flexibility: Drupal provides a highly flexible and extensible framework that allows developers to build websites and applications tailored to specific needs. It offers a wide range of modules, themes, and APIs, enabling the creation of custom functionalities and designs.
- Scalabi…
Using custom code disable cache from menu block in drupal 8
To disable caching for a specific menu block in Drupal 8 using custom code, you can implement the hook_block_view_alter hook in your custom module or theme. Here's an example implementation:
/** * Implements hook_block_view_alter(). */ function mymodule_block_view_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) { if ($block->getPluginId() === 'system_menu_block:my-menu') { // Disable caching for the menu block. $build['#cache']['max-age'] = 0;…
User related methods in DRUPAL 8
Get user role of current loggedin user
$user_roles = \Drupal::currentUser()->getRoles();
will return an array like:
Array
(
[0] => authenticated
[1] => administrator
[2] => some_other_role
)
Get user detail of curent loggedin user
$user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id()); user_delete(uid); $user_roles = \Drupal::currentUser()->getRoles(); $user = \Drupal\user\…
Update node field value of a content type using batch process in Drupal 9
To update the text field value of a content type in Drupal 9 using a batch process, you can follow these steps:
Create a custom module: If you don't have one already, create a custom module in the 'modules/custom' directory of your Drupal installation.
Define a form to receive the user input: Create a form in your custom module that takes the new value for the text field as input from the user. This form will be used to trigger the batch process.
Implement the batch process:…
Twig Template Naming in Drupal 10 Themes
Twig templates are files with the .html.twig extension used to define the HTML structure and layout of various components in Drupal. These templates allow developers to customize the look and feel of pages, blocks, nodes, and other elements.
Drupal uses a hierarchical template naming system, making it possible to override templates for specific components, entities, or conditions. By naming templates according to conventions, you can ensure they are applied to the correct contexts.
…To remove index.php from URL in Drupal 8
By default adding /index.php/ in URL so how to remove index.php from URLs in Drupal 8
I have added the following code in .htaccess file then the issue has been resolved
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
Other method you can try to stop indexing this type of URLs in Google or other search engine
Add the following code in robots.txt
Disallow: /index.php/*
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-project
Use the following Composer command to download the module:
composer require drupal/module_name
Replace module_name
with the actual machine name of the module. For example, to install the Pathauto module:
composer require drupal/pathauto
This will download the module and place it inside the…
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 Override
Drupal uses Twig templates to render product pages. The most relevant template for product pages is:
commerce-product--[product-type].html.tw…
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 Tag
The 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)
Example
html--[internalviewpath].html.twig html--node--[nodeid].html.twig html.html…
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…
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.
…