Module Development

Create custom modules with the Drupal API.

It's helpful to think of the existing core and contrib code as examples of the Drupal API that you can copy and reuse as needed.

Drupal API

An API can refer to a service that provides data, or the functions and objects available to a programming language. We're talking about Drupal's internal API for writing module code.

Drupal has several APIs under the hood to handle various aspects of the system. Some are commonly used by developers, and others are more specialized.

Here is the API documentation: https://www.drupal.org/docs/drupal-apis.

api.drupal.org

You can browse the API on the web at api.drupal.org. The links on the landing page are extremely useful for developers to read, as they explain the details on how systems work.

You can search for functions, files or classes. The source code is available, as well as previous versions.

The API pages are generated from the source code. As you gain experience navigating code in your IDE you will find ways to quickly access the same information when you need to look it up.

MODULE.api.php files

Drupal modules have hooks that allow contrib modules and site developers to modify how things are loaded and displayed. Modules have MODULE.api.php files that thoroughly document available hooks and provide examples.

Level