Blogs

How to submit a form from another submit handler.

In some cases, we might want to modify the form submission behaviour to better fit a particular use case. For instance, we would like to offer our own submit handler, and we will contact the original submit handler under specific circumstances.

Here, we'll utilise the module name example to change the way a form submits when its form ID is demo_form, which is provided by demo module. To do this, we'll create the code that follows in example.module file:

5.0/5

How to use the Drupal 9 module in a Drupal 10 project using Composer if its MR is already ready for Drupal 10 compatibility

We have often found that in the Drupal 9 project, multiple modules are not compatible with Drupal 10, and when we check the module issue queue, especially with the term "Automated Drupal 10 compatibility fixes", we can find at least one issue where the project update bot creates this issue automatically against each module and provides a patch with possible fixes except for making changes in module.info.yml.

0/5

How to create pager in drupal 8/9 for custom data set

Sometimes we need to create a pager for custom data sets, such as retrieving specific types of nodes and applying a filter on top of it to get the expected data set.

In this post, I am going to create a custom Drupal module named pager_example, which will create a pager for a custom data set.

Register a path where we will display a page with a pager using a custom data set. For that, I am going to create a routing file with the name "pager_example.routing.yml", which will have the following snippet:

0/5

Setup development environment for Drupal on windows 10

Being a Drupal developer, I would prefer to work on a Mac or Linux (Ubuntu) operating system for fast and hassle-free development work, but sometimes you will not get such preferences, may be due to organizations’ norms.

Assume you have a Windows machine for local development and have been assigned to a Drupal project, and you have now configured your local machine for the Drupal project.

In this post, I'll walk you through the steps for setting up a local development environment for Drupal.

0/5

Use of Drupal module uninstall validators and lazy services

Sometimes we do not want users to uninstall a Drupal module directly, but instead want to perform some checks first.

Let's take a scenario where installing a custom module creates node types along with some fields. Later on If a user wishes to uninstall that module (assuming some content has already been created on the site using the node types that are created by this module), then uninstalling that module can cause a serious problem. It should ask the user to delete the content first that has been created on the site using these node types before uninstalling the module.

0/5

Setup Drupal 9 with acquia BLT

First we will create a Drupal 9 project with the recommended template using the below command.

composer create-project drupal/recommended-project blt-drupal --no-install

This will create a project with the name blt-drupal, since Acquia BLT requires a document root to be docroot, so let's update the project's composer.json file accordingly.

0/5