This is the code repository for Drupal 10 Module Development - Fourth Edition , published by Packt.
Develop and deliver engaging and intuitive enterprise-level apps
Drupal 10 Module Development is a one-stop guide that dives deep into creating complex custom modules for business needs. This book is updated on the latest version of Drupal 10, which will take you through Drupal architecture, data modeling, and APIs for module development along with recent enhancements in Drupal 10 core releases.
This book covers the following exciting features:
- Gain insight into the Drupal 10 architecture for developing advanced modules
- Master different Drupal 10 subsystems and APIs
- Optimize data management by modeling, storing, manipulating, and processing data efficiently
- Present data and content cleanly and securely using the theme system
- Understand helpful functions while dealing with managed and unmanaged files
- Ensure your Drupal app has business logic integrity with automated testing
- Implement secure coding in Drupal
If you feel this book is for you, get your copy today!
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
hello_world.hello:
path: '/hello'
defaults:
_controller: Drupal\hello_world\Controller\HelloWorldController::helloWorld
_title: 'Our first route'
requirements:
_permission: 'access content'
Following is what you need for this book: If you are a Drupal developer looking to learn Drupal 10 to write modules for your sites, this book is for you. Drupal site builders and PHP developers with basic object-oriented programming skills will also find this book helpful. Although not necessary, some Symfony experience will help with understanding concepts easily.
With the following software and hardware list you can run all code files present in the book (Chapter 1-18).
Chapter | Software required | OS required |
---|---|---|
1-18 | Drupal 10 | Windows, Mac OS X, and Linux (Any) |
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.
To set up a local development environment, perform the following:
- Run the following commands:
$ docker-compose up -d
$ docker-compose exec php composer install
$ docker-compose exec php ./vendor/bin/run drupal:site-install
- Go to http://localhost:8080 and you have a Drupal site running. To log in, use
admin
/admin
.
The modules covered in the book are found inside the packt
folder in the root of the project. These are duplicated in each chapter and are individually symlinked in the Drupal custom module folder.
By default, when setting up the project, the chapter 2 modules are symlinked. You can change this by creating a local runner.yml
file and overriding the chapter
value that is used in the symlink (check the default in the runner.yml.dist
file).
Once that is done, you can run the following command to symlink the right modules:
$ docker-compose exec php ./vendor/bin/run drupal:module-setup
All outgoing sent using the native PHP mailer are caught using Mailhog. You can access the emails at http://localhost:8025.
Run tests as follows:
$ docker-compose exec -u www-data php ./vendor/bin/phpunit
This will run all the tests in the configured packt modules.
To run the coding standards check, use this command:
$ docker-compose exec php ./vendor/bin/run drupal:phpcs
And this command to try to automatically fix coding standards issues that pop up:
$ docker-compose exec php ./vendor/bin/run drupal:phpcbf
Daniel Sipos is a senior web developer specializing in Drupal. He's been working with Drupal sites since version 6, and started out, like many others, as a site builder. He's a self-taught programmer with many years' experience working professionally on complex Drupal 7 and 8 projects. In his spare time, he runs webomelette, a Drupal website where he writes technical articles, tips, and techniques related to Drupal development.
If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.