Skip to main content

Posts

Welcome to the Drupal Playground!

Hey there, Drupal enthusiasts! 🎉

We’re thrilled to welcome you to Drupal Playground, where creativity, innovation, and the power of Drupal come together. This is your space to explore, learn, and build amazing things using one of the most flexible CMS platforms out there.

Happy Drupaling!
— The Drupal Playground Team

Drupal Acquia Cloud , DAM and Cloud Hub Interview questions

  What is Acquia Cloud and how is deployment handled there? Acquia Cloud is a managed Drupal hosting platform built on AWS that provides autoscaling, security, CI/CD pipelines, and monitoring tools like Insight and New Relic. Code deployment is Git-based — we push code to the repository, and Acquia pipelines promote the branch to Dev, Stage, or Prod environments. Production is read-only, ensuring controlled deployments.

Drupal Interview Questions

 How to Create a Drupal Multisite?  In multisite, I create separate folders under /sites for each domain, configure individual settings.php with separate databases, and install Drupal per site while reusing the same codebase. Ex : sites/site.domain1/settings.php         sites/site.domain2/settings.php In multisite, even though the codebase is shared, module enablement is stored in each site's configuration. So enable the module only on the required site via admin or drush, and it remains disabled on other sites because they have separate databases. Then you must maintain separate config sync folders per site . $config_directories['sync'] = '../config/site1'; In multisite, apart from settings.php, we use services.yml for service overrides, separate files directories for uploads, private file paths, and most importantly separate config sync directories to isolate configuration per site.

Drupal Interview Questions

  What is the difference between Configuration and Content in Drupal? Give examples. Configuration represents the site structure and behavior stored in YAML files — such as content types, views, fields, permissions, and site settings. Content is the actual data stored in the database — like nodes, users, taxonomy terms. Configuration is deployed across environments using config management, while content is environment-specific.

How to Display Only the Created/Updated Date in Drupal 11 Views (Without

 In Drupal 11 , when you add the created date field in a View, you might see output like this: <time datetime="2025-08-06T08:01:47+00:00" title="Wednesday, August 6, 2025 - 08:01" class="datetime">08/06/2025 - 08:01</time> If you only want the plain date/time string like: 08/06/2025 - 08:01 Why Default Options Don’t Work in Drupal 11 Even if you check “Strip HTML tags” , the <time> element still appears. Using custom formatters doesn’t fully remove the HTML. This is because in Drupal 11, the DateTimeFormatter automatically wraps date output in a <time> element , by default. Solution Here’s how you can display just the plain date/time string: Steps: Go to your View in the Drupal admin. In the Fields section, edit the "Authored on / created " field. Check the box: “Rewrite results” In the "Text to display" box, enter this Twig code: {{ created.value|date("m/d/Y - H:i") }} (Change the date for...

Integrating ChatGPT with Drupal 10: A Step-by-Step Guide

  In this blog post, we will guide you through the process of integrating OpenAI’s powerful language model, ChatGPT, into your Drupal 10 website using the OpenAI Contrib module. We'll walk you through the steps of downloading the OpenAI Contrib module (using beta4), setting up an API key from OpenAI, and configuring your Drupal site to use this key for seamless integration. Before you begin, make sure you have an active OpenAI account and have generated your API key from the OpenAI platform. This key will be used to authenticate and allow your Drupal site to interact with the OpenAI service. Steps : 1. Get the latest version of  Open AI  module from the Drupal website and install it on your site.    2.  After installing and enabling the module, navigate to the OpenAI configuration settings and enter your API key.   Generate your OpenAI API key by visiting https://openai.com/api/ .       3.  After configuring the API keys, go to the ...

How to Enable the pg_trgm Extension in PostgreSQL

 If the  pg_trgm  extension is not present in your PostgreSQL setup, here's how you can enable it. Log in to your PostgreSQL database:                                                              psql - U postgres                                              Enable the pg_trgm extension by running the following command: CREATE EXTENSION IF NOT EXISTS pg_trgm;                                                                Verify that the extension is enabled: SELECT * FROM pg_extension WHERE extname = 'pg_trgm' ;  

How to Install Multiple XAMPP Servers

In this guide, we'll explore how to install multiple XAMPP servers on your system. Steps :   Download the Required XAMPP Version:                                                                                        Visit the XAMPP Download Page and select the version that suits your needs. You can choose from various XAMPP versions, each with a different PHP version. Install XAMPP Server: Run the installer and follow the on-screen instructions to install XAMPP on your system. You can install multiple versions of XAMPP in separate directories to run them simultaneously.                        Once the installation is complete, navigate to the XAMPP installation folder. Inside the XAMPP folder, go to...

How to Install Multiple PHP Versions on Ubuntu

I’ve shared the commands I used to install different PHP versions on my system. Currently, I have two versions of PHP installed and have now added the latest PHP 7.4 version. To check the PHP versions already installed on your system, follow these steps. sudo update-alternatives --list php The output of the above command shows the PHP versions installed on your system: /usr/bin/php5.6 /usr/bin/php7.3       (or) sudo update-alternatives --config php The output of the above command shows the PHP versions installed on your system: There are 2 choices for the alternative php (providing /usr/bin/php).   Selection    Path             Priority   Status --- ---------------------------------------------------------   0            /usr/bin/php7.3   73        auto mode * 1         ...

Drush Commands

 The " drush cim" and " drush cex" commands are used for importing and exporting configuration changes from one environment to another environment. drush cim (Configuration Import) The drush cim command is used to import configuration changes from the configuration synchronization directory ( sync folder). This will import all configuration files from the default sync directory. drush cex (Configuration Export) The drush cex command is used to export the current configuration of your Drupal site into the configuration synchronization directory . This Drush command is used to transfer configuration changes seamlessly, ensuring that no details are missed. It allows us to track all configuration changes at each stage of the process.

Integrating NLP Processing into Elasticsearch

  Natural Language Processing (NLP) and Elasticsearch are powerful technologies in their own right. When combined, they can elevate search functionality to new levels, enabling capabilities like semantic search, intent detection, and sentiment analysis. In this post, we’ll explore how to integrate NLP processing into Elasticsearch to enhance search results, with technical insights and practical examples. In my Elasticsearch setup, I have implemented a specific configuration to enhance functionality. While Elasticsearch offers several other options, I am currently utilizing this particular approach to meet my requirements I followed these steps to include a specific model for supporting NLP processing: Open the Kibana tool and navigate to the  Machine Learning  menu in the left sidebar under the  Analytics  section.  Select the  Trained Models  option.  On the trained model listing page, download the  Elser model  (in my system, it s...

Drupal 9 Trusted host patterns

  Error :   The trusted_host_patterns setting is not configured in settings.php. This can lead to security vulnerabilities. It is highly recommended that you configure this. See Protecting against HTTP HOST Header attacks for more information. Solution :  Open the  settings.php  file and insert the following code snippets based on your application requirements: a. For Localhost Setup: If your application is running on a local server (e.g., XAMPP or WAMP), and the URL starts with  http://localhost/project , include the localhost configuration in the settings. b. Multiple URLs Support: Users can define and include any number of URLs as needed for their setup. c. Subdomain Handling: If your application uses multiple subdomains, you can enable support for all subdomains under a specific domain (e.g.,  dev.com ) using a regular expression like  ^.+\.dev\.com . This configuration ensures that all subdomains under  dev.com  are accepted. d...

Set Custom Header Variables for API in Drupal 9

Create and Install a Custom Module Create an Event Subscriber in the Custom Module . Place the Event Subscriber file in the src/EventSubscriber folder of the custom module. <?php // In your_module/src/EventSubscriber/CustomHeaderSubscriber.php namespace Drupal\custom\EventSubscriber ; use Symfony\Component\EventDispatcher\ EventSubscriberInterface ; use Symfony\Component\HttpKernel\Event\ RequestEvent ; use Symfony\Component\HttpKernel\ KernelEvents ; use Symfony\Component\HttpKernel\Exception\ AccessDeniedHttpException ; use Symfony\Component\HttpFoundation\ Response ; /**  * Event subscriber to check for a custom header in incoming requests.  */ class CustomHeaderSubscriber implements EventSubscriberInterface {   /**    * { @inheritdoc }    */   public static function getSubscribedEvents () {     // Subscribe to the request event, with a priority of 30     $ events [ KernelEvents:: REQUEST ][] = [ 'checkCusto...

Drupal "No plugin ID specified issue" in custom block

Issue While Assigning Custom Block to Block Layout or Layout Builder Error Message: Drupal\Component\Plugin\Exception\PluginException: No plugin ID specified for component with "XXXXXX" UUID in Drupal\layout_builder\SectionComponent->getPluginId() (line 218 of D:\xamp\htdocs\coin\web\core\modules\layout_builder\src\SectionComponent.php). This error occurs because the plugin ID and definition for the custom block are not properly specified. Plugin IDs are unique identifiers used in Drupal to define new components like block types, field types, menu items, and more. Solution: To resolve this issue, ensure that the plugin ID and definition are correctly added to the __construct() function of your custom block code. Ex :  namespace Drupal\module_name\Plugin\Block ; use Drupal\Core\Block\ BlockBase ; /**  * Description  *  * @Block(  *   id = "Id of the block",  *   admin_label = @Translation("Block Name"),  * )  */ class block_class e...

MySQL Shutdown Unexpectedly (Blocked Port Issue) in XAMPP

Sometimes MySQL in XAMPP shuts down unexpectedly, often due to a blocked port or corrupted data files. Below is a simple method that worked successfully on my local machine. ⚠️ Important Note Before making any changes, always take a backup of your MySQL data to avoid accidental data loss. Steps to Resolve the Issue Navigate to your XAMPP installation directory. Open the following path:   xampp > mysql > data Inside the data folder: Select all files Delete only the files , do not delete the folder itself For safety, you can copy these files to another location as a backup Once the files are removed, restart XAMPP. Try starting the MySQL server again. In my case, MySQL started successfully after following these steps. Why This Works Sometimes MySQL fails to start due to corrupted temporary or log files. Removing these files forces MySQL to recreate them when the server starts, which can resolve the issue.

HTTP 406 Not Acceptable Error

 Recently, my websites suddenly started showing the HTTP 406 – Not Acceptable error. This issue appeared without any changes made on my end, which made it a bit confusing at first. Initial Troubleshooting After searching online, I found that many people suggested disabling the mod_security module, as it can sometimes block legitimate requests. I tried the recommended configurations to turn off mod_security, but unfortunately, that solution did not work for me. Actual Cause & Solution I then contacted my website’s hosting/server support team and explained the issue in detail. After checking their logs, they informed me that: My requests were being blocked by server security rules The affected requests were not whitelisted They removed the blocking rule / added my requests to the whitelist Once this was done, the websites started working normally again.