11.0.x

Add a Template File

Last updated

Discover Hooks and Their Documentation

Last updated

Concept: Anatomy of a Module

Last updated

A Drupal module encapsulates files and directories that serve a specific purpose and follow Drupal's standards and conventions. This tutorial describes the anatomy of a Drupal module, focusing on the placement and purpose of different file types.

In this tutorial, we'll:

Concept: PHP Namespaces and PSR-4

Last updated

Drupal uses PSR-4 namespaces to autoload the correct PHP class from a file, accommodating variations in site structures. As a module developer, it's important to understand PSR-4, as it dictates the location within your module directory for most of your custom code.

In this tutorial, we'll:

Set Up Your Development Environment

Last updated

Concept: Services and the Container

Last updated

As a development framework, Drupal core includes services for doing common things like accessing the database, sending email, or making HTTP requests. You can make use of these services to perform certain tasks, instead of recreating them in your own code. This means less custom code that you need to write and maintain. Generally speaking, almost everything that Drupal does is actually done by one of these objects. In Drupal, these objects are called services and in order to make working with them easier, they are primarily accessed through the service container.

Concept: Routes

Last updated

As a module developer, you use routes defined in a module to add new URLs and tell Drupal which code to execute to build content for the page at those URLs. Central to this process is Drupal's routing system, built upon Symfony's Routing component.

In this tutorial, we'll:

  • Introduce Drupal's routing system.
  • Learn how modules can define new routes.
  • Describe the roles that routes serve in a module.

By the end of this tutorial, you should understand each parameter of a route definition in a module's MODULE_NAME.routing.yml file.

Concept: Controllers

Last updated

Concept: What Are Hooks?

Last updated

Hooks in Drupal enable modules to alter or extend the behavior of Drupal core or other modules. By implementing functions with specific names, modules can intervene at various points in Drupal's execution flow. This tutorial introduces hooks, their implementation, and their significance in module interaction.

In this tutorial, we'll:

Save Form Data Submitted by a User

Last updated