Creating modules

This guide includes tutorials and other information that you need to create modules for Drupal 8 and later.

Other resources:

Getting Started - Background & Prerequisites

Drupal leverages advanced PHP language features & sophisticated 3rd party libraries for better developer experience

Naming and placing your Drupal module

Main topic described: module naming and location

Let Drupal know about your module with an .info.yml file

Main topic described: project metadata

Include default configuration in your Drupal module

Main topic described: default configuration

Defining and using your own configuration in Drupal

Main topic described: defining own configuration

Create a custom page using a controller

Create a simple page in Drupal by declaring the path and options and writing a callback that returns the page body.

Creating custom blocks

Unlike in Drupal 7, creating multiple instances of a block to place on your site is an easy task in Drupal 8.

Creating custom field types, widgets, and formatters

Create a custom field type, widget, and formatter in Drupal 8.

Subscribe to and dispatch events

Get to know Symfony events in Drupal and find out how they relate to Drupal hooks.

Building a Views display style plugin for Drupal

Here's a step by step guide on how to create a Views display style plugin.

Adding assets (CSS, JS) to a Drupal module via *.libraries.yml

This documentation is for modules. For the themes, see Adding stylesheets (CSS) and JavaScript (JS) to a Drupal theme.

Basic module building tutorial: Lorem ipsum generator

Step-by-step guide for module building beginners. 

Step by step tutorial: Hello World

A step-by-step tutorial for building a module

Understanding hooks

Hooks are one of the ways how that modules can interact with the other modules or Drupal core subsystems.

Guide maintainers

pancho's picture
kaymccormick's picture