9.5.x/10.0.x

Audience and Approach

Last updated

Are you ready to learn how to extend and customize Drupal sites in code? The Drupal Module Developer Guide will introduce you to extending Drupal with modules. You will learn foundational concepts and get hands-on practice with a variety of APIs used in Drupal coding and development. We'll be extending the site we built in the Drupal User Guide. If you're new to Drupal site building, we recommend that you walk through the Drupal User Guide first.

Goal

Decide if this guide is for you.

Guiding Scenario

Last updated

We'll be working with the Anytown Farmers Market site, which we built in the Drupal User Guide. Our goal is to extend and enhance this site using custom modules, to fulfill project-specific requirements. We use a narrative approach, which we hope will help you better understand the real-world applications of module development in Drupal.

Goal

Explain the guiding scenario which ties together all the code examples in this guide, and provides a project-based learning approach to Drupal module development.

Concept: What Are Modules?

Last updated

Modules enable developers to customize Drupal without modifying the core software. To ensure a stable and upgradeable core system, Drupal defines integration points and patterns that developers can use to customize the system. Modules contain code (PHP, JavaScript, Twig, CSS, YAML, etc.) that can extend, alter, and enhance Drupal's features and functionality.

In this tutorial, you'll learn:

Write a Unit Test

Last updated

Write a Kernel Test

Last updated

Write a Functional Test

Last updated

Configure Your Environment to Run Tests

Last updated

Concept: Testing

Last updated

Testing ensures that code remains reliable and functional. This tutorial introduces the primary types of tests in Drupal: Unit, Kernel, Functional, and FunctionalJavascript -- all executed via PHPUnit. We'll clarify the differences between each type of test and appropriate use cases. As module developers, understanding what to test and how to write tests is vital for robust and maintainable code.

In this tutorial, we'll:

Locate and Identify Existing Services

Last updated

Concept: Creating Custom Services

Last updated