Creating a module
The first step to extending Drupal is to create a custom module. Although the task sounds daunting, it can be accomplished in a few simple steps. Modules can provide functionalities and customizations for functionalities provided by other modules, or they can be used as a way to contain the configuration and a site’s state.
In this recipe, we will create a module by defining its modulename.info.yml
file, a file containing information that Drupal uses to discover extensions and install the module.
How to do it…
- In your
web/modules
directory, create a new directory calledcustom
and then another directory namedmymodule
inside it. This will be your module’s directory. Using the command line, you may create the directory with the following command:mkdir -p web/modules/custom/mymodule
This will create the required directories.
- Create a
mymodule.info.yml
file in your module’s directory. This will contain the metadata...