Guide

Alter Drupal in Modules for Drupal 8, 9, and 10

What will you learn

  • Overview of hooks, their purpose, and how they work
  • How to implement a hook of any type
  • What plugins are, their purpose, related terminology, and how they work
  • Recipe for implementing any plugin type
  • Discovering and using existing services
  • Subscribing to existing events
  • Defining new events and dispatching them from a custom module
  • Differences between hooks and events

Overview

In this guide for developers, you'll learn how to alter, extend, and enhance Drupal through hooks, plugins, events, and services.

Hooks in Drupal are predefined points in the code where developers can insert custom functions to modify or extend core behavior without altering core files, making them essential for implementing custom functionality and maintaining upgradability.

Plugins in Drupal are reusable, interchangeable pieces of functionality defined by standardized interfaces, and knowing how to use them is crucial for developers to create modular, extendable components that enhance site functionality while promoting code reuse and maintainability.

Services are reusable PHP objects that encapsulate specific functionality or logic, as a module developer you’ll need to know how to discover and use existing services as well as author new ones for your application specific logic.

Events in Drupal are a mechanism for triggering and responding to specific actions within the system, and developers need to know how to use them to implement custom behaviors and integrations in a decoupled and flexible manner.

Drupal developer learning resources

Hooks

This course covers what hooks are, how they enable modules to alter or extend Drupal's core functionality, and the process of implementing, discovering, and defining new hooks.

In this related topic, you'll find both Drupalize.Me and external resources to help you along.

Hooks

Topic
Drupal 7, 8, 9, and 10
More information

Hooks allow modules to alter and extend the behavior of Drupal core, or another module. As a Drupal developer, understanding how to implement and invoke hooks is essential.

Plugins

This course covers the fundamental concepts of the Plugin API, including plugin types, discovery mechanisms, and how to implement and manage plugins. Learn to define new plugin types, use plugin managers, and understand the role of plugin factories and derivatives.

In this related topic, you'll find both Drupalize.Me and external resources to help you along.

Categories
Drupal 8, 9, and 10
More information

Plugins are one of the ways that module developers can write code that extends Drupal. The Drupal Plugin API allows a module to provide functionality in an extensible, object-oriented way.

Services

This course covers the fundamental concepts of services and the service container, including how to discover and use existing services, and the best practices for injecting these services into your code.

1 tutorials
Tutorials in this course

In these related topics, you'll find both Drupalize.Me and external resources to help you along.

Services

Topic
Categories
Drupal 8, 9, and 10
More information

Services are objects that encapsulate the code for performing specific tasks in a reusable and decoupled way.

Categories
Drupal 8, 9, and 10
More information

Dependency injection is a design pattern commonly used in object-oriented software architectures in order to support Inversion of Control.

Events

This course covers the fundamental concepts of events, including how to discover existing events, subscribe to them, and dispatch new events.

In this related topic, you'll find both Drupalize.Me and external resources to help you along.

Events

Topic
Categories
Drupal 8, 9, and 10
More information

Events are one of the ways that module developers can alter or extend Drupal without modifying existing code.

“Drupalize.Me has trained thousands of Drupalistas. Their video lessons help to address our constant need for more Drupal talent. Drupal needs training like this to support its growth.”
Dries Buytaert
Drupal Founder and Project Lead
Photo of Dries Buytaert
“They’re easy to understand. They’re thorough. They’re funny. They’re always entertaining, and it makes it easy to learn parts of Drupal and how you can integrate it into your workflow and learn more and have a good time doing it.”
Roger Carr
Drupalize.Me Member
Photo of Roger Carr
“The mission of the Drupal Association is to foster and support the Drupal software project, the community, and its growth. Drupal education, like that provided by Drupalize.Me, is important to this mission.”
Megan Sanicki
Former Exec. Director, Drupal Assoc.
Photo of Megan Sanicki

FAQs

Am I required to sign a contract?
No. You can purchase a membership and/or cancel any time. Drupalize.Me is a pay-as-you-go service.

Can I preview tutorials before joining?
Yes! Just navigate to our tutorial library. Our free tutorials are labeled with a green "FREE" tag.

Can I watch videos on my mobile device?
Yes! Drupalize.Me is a responsive site and can be accessed in the browser on any mobile device. More FAQs