In Drupal CMS, you can add features and functionality to your site without writing any code by using modules. Modules are bundles of code that provide specific features and capabilities to your site.
In this tutorial, we’ll:
- Explain the difference between modules, recipes, and projects.
- Show how to install modules to add features to your site.
- Point you to where you can find and add community-contributed modules.
Prerequisites
- To follow along, install and set up Drupal CMS locally or using the in-browser trial.
- We’ll assume you know how to get around Drupal CMS.
What are modules?
Modules are bundles of code that provide specific features and capabilities to your site.
Drupal CMS includes many modules, some of which are installed by default and others that are only installed if needed.
In the Extend admin area, browse included modules, download and install additional contributed modules from Drupal.org, and apply security updates for installed modules.
For truly tailored features, you can author your own custom modules.
Learn more about modules in Drupal in 1.2. Concept: Modules (Drupal User Guide).
Modules, recipes, and projects
In the Extend area, you’ll encounter both modules and recipes. Let’s break down the differences between these two types of packages.
Modules
A module is a package of code that integrates with Drupal CMS’s APIs. They are used to extend, or alter Drupal CMS’s capabilities. They can provide new features or modify existing behavior. Modules give the site administrator the ability to add features and functionality to their Drupal CMS site without writing code.
Examples:
- The Views module enables advanced content querying and display.
- The Webform module allows for the creation of forms for user submissions.
- The Pathauto module automatically generates URL aliases.
Recipes
A recipe is a higher-level configuration package that assembles existing Drupal components (like modules, configuration, or content types) into a specific solution using smart defaults. Recipes use the functionality provided by existing modules, and best practice configuration to make it quicker to get started assembling a site.
Examples:
- A Blog recipe might include a blog post content type, configuration for a vocabulary named tags, and preconfigured views for listing posts.
- A Portfolio recipe might include a content type for projects, configuration for displaying high-resolution media, and layout builder settings for showcasing projects on a grid.
- A Solr search recipe might include a list of modules required to integrate Drupal CMS’s content with a Solr search index, configuration for indexing common fields, and a view configured to provide a search UI for users.
Learn more about recipes in Add functionality with smart defaults.
Project
A generic term used to describe a set of code files, hosted on Drupal.org, that integrate with Drupal to provide new functionality. Projects can be modules, themes, or recipes.
Install a module
You can turn the features and functionality of a module on by installing the module, and you can turn it off by uninstalling the module. To install a module:
- Go to Extend (/admin/modules) in the navigation toolbar.
-
This page lists the modules already included in your Drupal CMS site with a checkbox next to each. Modules that are already installed will appear checked.
- Find the module(s) you wish to enable in the list, and check the corresponding checkbox.
- Scroll to the bottom of the page and select Install to install the selected modules.
-
Success! 🎉After a module has been installed you should see a success message, and in some cases, links to get started configuring the new features it provides.
Find and install additional modules
There are thousands of contributed modules on Drupal.org that you can use to further customize your site. If there’s a third-party service you want to integrate with, or a feature you need to add, chances are high that there is an existing solution you can use to get started.
To find and install additional modules you can use the built-in project browser.
- Go to Extend (/admin/modules) in the navigation toolbar.
- Select the Browse link.
-
Use the provided search tools and filters to locate the module or recipe you want to install.
- Press the Install button for each module you want to install.
Learn more about a module before installing it
Contributed modules are maintained by the Drupal community on Drupal.org. Each module has a project page with details about the project, an issue queue to get support and report bugs, and more. Each project name on the Browse projects page is linked to the corresponding project page on Drupal.org. The project page includes an extended description of the modules included in the project, release information, and links to any available documentation.
Learn more about what’s included on a project page, and how to use that information to further evaluate a module in the Drupal User Guide’s Finding Modules tutorial.
Uninstall a module
Modules whose features are no longer needed should be uninstalled.
Note: Uninstalling a module can be destructive. While most modules will do their best to warn you about any changes, it is a good idea to make a backup before uninstalling just in case.
To uninstall a module:
- Navigate to Extend > Uninstall (/admin/modules/uninstall) where you will find the list of modules that are ready to be uninstalled.
- Check the boxes for the modules you are uninstalling. Click Uninstall at the bottom of the page.
-
Step 2 will prompt you to confirm the module uninstall request. Click Uninstall.
- You should see a message indicating that the module(s) have been successfully uninstalled.
To learn more see Uninstalling Unused Modules (Drupal User Guide).
Wrap-up
Modules are code packages that provide specific features and functionality to your site. You can add modules that alter and extend Drupal CMS’s existing functionality in the Extend area. A module's features are added to your Drupal CMS site when the module is installed, and removed when the module is uninstalled.
Additional resources
- Drupal User Guide 1.2. Concept: Modules (Drupal.org)
- Drupal User Guide 11.1. Finding Modules (Drupal.org)
- Drupal User Guide 4.3. Installing a Module (Drupal.org)
- Drupal User Guide 4.4. Uninstalling Unused Modules (Drupal.org)