Adding and managing module and theme extensions
Drupal is extremely versatile due to its composable design and its large ecosystem of contributed modules and themes. Composer is used for installing and upgrading extensions on your Drupal site using its require
and update
commands. In this recipe, we will add the popular Pathauto module (https://www.drupal.org/project/pathauto) and the Barrio theme (https://www.drupal.org/project/bootstrap_barrio), a Bootstrap 5 theme.
How to do it…
- Open a terminal and navigate to your Drupal code base.
- First, we will add the
Pathauto
module using therequire
command:composer require drupal/pathauto
Composer will output some data as it begins resolving the Pathauto
package. You will notice that the module dependencies for Pathauto
were also downloaded: Token
and Chaos Tools
.
The modules will be installed into the web/modules/contrib
directory.
- Next, we will add the Barrio theme:
composer require drupal/bootstrap_barrio...