Latest Tutorials

Found 9 results

Controllers

Create a Custom Controller in Drupal 11 with PHP Attributes

Learn how to create a controller using PHP attributes in Drupal 11.4.x. In this step-by-step tutorial, you'll build a custom module, define a controller with PHP attributes, create a custom route, and return content as a render array.

Controllers

Creating an HTMX route

HTMX relies on the server returning HTML fragments rather than JSON. While Drupal usually wraps content in a full page shell (header, footer, sidebars), this tutorial shows you how to return an HTML response that HTMX can swap into your existing page.

Controllers

Creating a custom controller

In Drupal, a controller is responsible for receiving a request and returning a response usually in the form of a Render Array. In this tutorial, we will build a module that displays a simple message and a data table at a custom URL.

Twig

Extending Twig functions and filters

Enhance your Drupal themes by adding custom Twig filters and functions. This guide shows how to extend Twig in a Drupal-friendly way using your own module and PHP classes.

Blocks

How to Create a Custom Block in Drupal

Learn how to create a custom block in Drupal using the Block module. This guide covers both the user interface method and the programmatic approach using a custom module.

Modules

How to add redirects programmatically in Drupal

Redirects are essential for managing changes in URLs, especially when restructuring a site or removing pages. In this tutorial, we’ll walk through how to add redirects programmatically in Drupal using custom code.

Showing 19 of 9 tutorialsPage 1 of 1