Site Building
Topic

Extend Drupal with Modules for Drupal 7, 8, 9, and 10

Modules are bundles of primarily PHP code that extend Drupal in order to add new features or alter existing functionality. Modules can be installed to enable their features, and uninstalled to turn the features off. This flexibility allows Drupal users to tailor each instance of Drupal to their specific use case, and to use only the features of Drupal that they need. There are thousands of community-contributed modules available. A large part of learning Drupal involves learning how to locate, install, and evaluate existing modules in order to determine if the functionality they provide is what you need.

Developers can write PHP, HTML, CSS and JavaScript to create new modules when necessary. A module can provide generic functionality (for example, integrating with Twitter) with the intent of contributing it back to the community. A project-specific module can either alter existing features or contain new custom features in order to solve specific project requirements.

There are three main types of modules:

  • core modules: modules that are included with Drupal core and live in the /core/modules directory
  • contributed modules: modules downloaded from Drupal.org that are not part of Drupal core, and are typically placed in the /modules/contrib directory
  • custom modules: project-specific modules that you or another developer wrote specifically for your application, and are typically placed in the /modules/custom directory

Example tasks

  • Locate a contributed module on Drupal.org and install it on your site
  • Write a custom module for a project that adds new features or alters existing ones

Confidence

The basic concept of modules, how they are integrated into a Drupal site, and the role they play is unlikely to change, so we have high confidence in modules.

Drupalize.Me resources

Developers

The Drupal Module Developer Guide is the best way to get started with the concepts and APIs involved in writing custom code for Drupal. This guide builds on the concepts and skills covered in the Drupal User Guide.

Categories
Module Development
Drupal 8, 9, and 10

Explore Drupal APIs and development patterns in depth.

Categories
Module Development, Backend and Infrastructure
Drupal 8, 9, and 10

Site builders

Drupal 8, 9, 10, and 11
More information

Overview of modules and the functionality they can be used for.

More information

A module is a set of PHP, JavaScript, and/or CSS files that extends site features and adds functionality. The Drupal core software comes with a set of modules that provide a range of features.

More information

The process for keeping Drupal core and contributed modules and themes up to date with the latest security and minor version releases.

Related topics

More information

Composer is the preferred dependency management solution for PHP, is used by Drupal core, and is becoming increasingly popular for managing the modules and themes used for a Drupal project.

Hooks

Topic
Drupal 7, 8, 9, and 10
More information

Hooks allow modules to alter and extend the behavior of Drupal core, or another module. As a Drupal developer, understanding how to implement and invoke hooks is essential.

Categories
Drupal 8, 9, and 10
More information

Plugins are one of the ways that module developers can write code that extends Drupal. The Drupal Plugin API allows a module to provide functionality in an extensible, object-oriented way.

Drupal 7, 8, 9, and 10
More information

Entities are the fundamental building blocks that make up any Drupal site. Having a good understanding of the Entity system is an important part of ensuring the data model of your Drupal site is set up properly.

Services

Topic
Categories
Drupal 8, 9, and 10
More information

Services are objects that encapsulate the code for performing specific tasks in a reusable and decoupled way.

Routing

Topic
Categories
Drupal 8, 9, and 10
More information

Drupal's Routing API maps the URL of an incoming request to the code responsible for generating the content that is rendered in response.

Events

Topic
Categories
Drupal 8, 9, and 10
More information

Events are one of the ways that module developers can alter or extend Drupal without modifying existing code.

Drupal 7

More information

In this video we walk through two methods for downloading and installing new modules. First we use the administrative interface on our site to install a new module with a URL, and then we download a module directly from Drupal.org and place the files in the proper location in our Drupal files. We also talk about some best practices for organizing your modules in your file system.

Guides

Not sure where to start? Our guides provide useful learning tracks for all skill levels.

Navigate guides

External resources