Drupal

5 Ways to Include JavaScript in Drupal 9 for Enhanced Functionality

In this article, we are going to see how to include Javascript in Drupal and there are 5 Ways to Include JavaScript in Drupal 9 for Enhanced Functionality Adding JavaScript directly in a module or theme file You can include JavaScript code directly in your custom module or theme files using <script> tags. However, it’s […]

5 Ways to Include JavaScript in Drupal 9 for Enhanced Functionality Read More »

Supercharge Your Drupal Workflow: Building Custom Drush Command for Productivity

Drupal Custom Drush Command

In Drupal 9, the custom Drush command file should have a .drush.yml extension instead of .drush.inc. Create a custom module: Create a custom module named “my_custom_module” by following Drupal’s module development guidelines. Create the drush.services.yml file: Inside the my_custom_module module directory, create a drush.services.yml file. Define the command service: Open the drush.services.yml file and define

Supercharge Your Drupal Workflow: Building Custom Drush Command for Productivity Read More »

How to delete Drupal menu item programmatically

How-to-Delete-Drupal-Menu

Sometimes we need to delete the menu item programmatically, so the below code snippet will help you to delete any menu item programmatically. You need to pass the menu id to the entityTypeManager service and you need to call the delete method. $menu_link = \Drupal::entityTypeManager()->getStorage(‘menu_link_content’)->load(3); // Pass Menu Id $menu_link->delete();  

How to delete Drupal menu item programmatically Read More »