Core, Contrib, and Custom Modules

Objectives
  • The explain difference between core, contrib, and custom modules
  • Find the core modules folder in your Drupal project
  • Know where to place contrib modules
  • Know where to place custom modules
  • Be able to install and uninstall modules
Last revision:

Core

Drupal core refers to the Drupal CMS itself, as you install it out of the box. Drupal core is a collection of core modules and themes, some of which are installed (enabled) by default, and some of which you need to install manually.

While you can uninstall (disable) most core modules, some of them can't be uninstalled because they are essential to Drupal's core functionality.

Where do I find the core modules?

You can find the core modules of your Drupal installation at DRUPAL_ROOT/core/modules.

Note:

DRUPAL_ROOT refers to the location where your Drupal site is installed. It's the root folder of your Drupal installation. It contains folders such as 'core', 'modules', and 'themes', and files such as 'index.php', 'autoload.php', and 'README.md'.

Contrib

Drupal contrib refers to the ecosystem of third party modules, themes, and distributions you can download from drupal.org. Over time some contrib modules or themes become part of Drupal core, and some core modules get removed from core and live on as contrib modules.

The Views, Date, and Workflow modules are examples of modules that were part of contrib up to Drupal 7, and became part of core in Drupal 8.

Where do I place contrib modules?

Single site setup

If you're using Drupal for a single site (the most common use case), you should place additional modules in DRUPAL_ROOT/modules/contrib.

If there is no 'contrib' directory within DRUPAL_ROOT/modules, you should create it. Using a 'contrib' directory is a convention followed by almost everyone in the Drupal community. It's a simple way to distinguish third-party modules from your own custom modules.

Multisite-setup

If you're using Drupal in a multisite setup:

  •    Modules common to all sites should be placed in DRUPAL_ROOT/all/modules
  •    Modules only pertinent to specific sites should be placed in their respective 'sites' directory:
    • DRUPAL_ROOT/sites/demo_site/modules/contrib
    • DRUPAL_ROOT/sites/candystore.com/modules/contrib
    • ...

Custom

Custom modules, themes, and distributions are extensions that you or an agency built and added for a specific purpose. You may decide to be a good citizen and contribute your general purpose modules/themes to drupal.org, in which case they become part of contrib, or you my decide to keep your custom modules private.

Contributing modules is a great and selfless act. Community contributions are the life blood of opensource projects. However, if you contribute modules or themes, people will expect your continued support over time.

You should be ready to support the code you contribute, or make the limits and conditions of your support very clear.

Where do I place custom modules?

Single site setup

If you're using Drupal for a single site (the most common use case), you should place custom modules in DRUPAL_ROOT/modules/custom/

Multisite setup

  • If you're using Drupal in a multisite setup, you should place custom modules inside their respective 'sites' directory:
    • DRUPAL_ROOT/sites/demo_site/modules/custom/
    • DRUPAL_ROOT/sites/candystore.com/modules/custom/
    • ...