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

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...