𝔖 Scriptorium
✦   LIBER   ✦

πŸ“

Drupal 10 Module Development: Develop and deliver engaging and intuitive enterprise-level apps

✍ Scribed by Daniel Sipos


Publisher
Packt Publishing
Year
2023
Tongue
English
Leaves
580
Edition
4
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Build and customize powerful Drupal modules to extend your website's functionalities with this comprehensive guide

Purchase of the print or Kindle book includes a free PDF eBook

Key Features

  • Explore the new features and improved capabilities of Drupal 10 core
  • Discover Drupal APIs and elevate your proficiency by leveraging PHP coding
  • Implement efficient data management and data security by creating dedicated modules

Book Description

Embark on a journey of Drupal module development with the latest edition of this must-have guide written by Daniel Sipos – a Drupal community member! This fourth edition is meticulously revised to cover the latest Drupal 10 enhancements that will help you build custom Drupal modules with an understanding of code deprecations, changing architecture, data modeling, multilingual ecosystem, and so on.

You'll begin with understanding the core components of Drupal 10 architecture, discovering its subsystems and unlocking the secrets of creating your first Drupal module. Further, you'll delve into Drupal logging and mailing systems, creating theme hooks, and rendering a layout. As you progress, you'll work with different types of data storage, custom entities, field types, and work with Database APIs for lower-level database queries. You'll learn to reap the power of JavaScript and ensure that your code works seamlessly on multilingual sites. You'll also learn to create custom views, automate tests for your functionalities, and write secure code for your Drupal apps.

By the end of this book, you'll have gained confidence in developing complex modules that can solve even the most complex business problems and might even become a valuable contributor to the Drupal community!

What you will learn

  • 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

Who this book is for

If you are a Drupal developer looking to create custom modules for Drupal sites and cater business needs, this book is the one-stop solution for you. Drupal 10 Module Development will be helpful for Drupal site builders and PHP developers with basic object-oriented programming skills, looking to upskill themselves in Drupal module development. A basic working experience with Symfony will be helpful but not mandatory.

Table of Contents

  1. Developing for Drupal
  2. Creating your First Module
  3. Logging and Mailing
  4. Theming
  5. Menus and Menu Links
  6. Data Modeling and Storage
  7. Your Own Custom Entity and Plugin Types
  8. The Database API
  9. Custom Fields
  10. Access Control
  11. Caching
  12. JavaScript and the Ajax API
  13. Internationalization and Languages
  14. Batches, Queues, and Cron
  15. Views
  16. Working with Files and Images
  17. Automated Testing
  18. Drupal 10 security

✦ Table of Contents


Cover
Title Page
Copyright and Credits
Contributors
Table of Contents
Preface
Chapter 1: Developing for Drupal
Introducing Drupal (for developers)
How did we get to Drupal 10?
Developing for Drupal
Technologies that drive Drupal
PHP
Databases and MySQL
The web server
Drupal architecture
Drupal’s major subsystems
Tools for developing in Drupal
Summary
Chapter 2: Creating Your First Module
Creating a module
Your first hook implementation
Route and controller
Services
Using services in Drupal
Injecting the service into our Controller
Invoked Controllers
The Form API
Altering forms
Custom submit handlers
Rendering forms
Service dependencies
Blocks
Our first block plugin
Block configuration
Working with links
The URL
The link
Which way to link?
Event Dispatcher and redirects
Redirecting from a Controller
Redirecting from a subscriber
Dispatching events
Summary
Chapter 3: Logging and Mailing
Logging
The Drupal logging theory
Our own logger channel
Our own logger
Logging for Hello World
Logging recap
Mail API
The theory behind the Mail API
Implementing hook_mail()
Sending emails
Altering someone else’s emails
Custom mail plugins
Mail API recap
Tokens
The Token API
Using tokens
Defining new tokens
Tokens recap
Summary
Chapter 4: Theming
Business logic versus presentation logic
Twig
Theme hooks
Theme hook suggestions
Render arrays
The structure of a render array
The render pipeline
Assets and libraries
Libraries
Common theme hooks
Lists
Links
Tables
Attributes
Layouts
Defining layouts
Rendering a layout
Theming our Hello World module
Summary
Chapter 5: Menus and Menu Links
The menu system
Menus
Menu links
MenuLink trees
Rendering menus
Working with menu links
Defining menu links
Manipulating menu links
Defining local tasks
Defining local actions
Defining contextual links
Summary
Chapter 6: Data Modeling and Storage
Different types of data storage
The State API
TempStore
Private TempStore
Shared TempStore
Tempstore recap
The UserData API
Configuration API
Introduction
Configuration storage
Configuration recap
Entities
Content versus configuration entity types
Entity type plugins
Fields
Entity types recap
TypedData
Why TypedData?
What is TypedData?
The low-level API
Content entities
TypedData recap
Interacting with the Entity API
Querying entities
Loading entities
Reading entities
Manipulating entities
Creating entities
Rendering content entities
Pseudo-fields
Entity validation
Summary
Chapter 7: Your Own Custom Entity and Plugin Types
Our custom content entity type
Entity updates
Our custom plugin type
Our custom configuration entity type
The Importer plugin
Content entity bundles
Our own Drush command
Summary
Chapter 8: The Database API
The Schema API
Running queries
Select queries
Pagers
Insert queries
Update queries
Delete queries
Transactions
Query alters
Update hooks
Post update hooks
Summary
Chapter 9: Custom Fields
A recap of Field type plugins
Field type
Field widget
Field formatter
Field settings
Using our custom field type as a base field
Summary
Chapter 10: Access Control
Introduction to the Drupal access system
Roles and permissions under the hood
Defining permissions
Checking the user credentials
Route access
Custom route access
Programmatically checking access on routes
Bonus – dynamic route options for access control
CSRF protection on routes
Altering routes
Entity access
Injecting services into Entity handlers
Entity access hooks
Field access
Entity access in routes
Node access grants
Block access
Summary
Chapter 11: Caching
Introduction to caching
Cacheability metadata
Cache tags
Cache contexts
max-age
Using the cache metadata
Placeholders and lazy building
Lazy builders
Using the Cache API
Creating our own cache bin
Summary
Chapter 12: JavaScript and the Ajax API
JavaScript in Drupal
Drupal behaviors
Drupal settings
The Ajax API
Ajax links
Ajax in forms
The States (Form) system
Summary
Chapter 13: Internationalization and Languages
Introduction to the multilingual ecosystem
Language
Content translation
Configuration translation
Interface translation
Internationalization
Content entities and the translation API
Summary
Chapter 14: Batches, Queues, and Cron
Batch-powered update hooks
Batch operations
Creating the batch
Batch operations
Cron
Queues
Introduction to the Queue API
Cron-based queues
Processing a queue programmatically
The Lock API
Summary
Chapter 15: Views
Entities in Views
Exposing custom data to Views
Views data
Custom Views field
Field configuration
Custom Views filter
Custom Views argument
Views theming
Views hooks
Summary
Chapter 16: Working with Files and Images
The filesystem
Stream wrappers
Managed versus unmanaged files
Using the File and Image fields
Working with managed files
Attaching managed files to entities
Helpful functions for dealing with managed files
Managed file uploads
Our own stream wrapper
Working with unmanaged files
Private filesystem
Images
Image toolkits
Image styles
Rendering images
Summary
Chapter 17: Automated Testing
Testing methodologies in Drupal
PHPUnit
Registering tests
Unit tests
Mocked dependencies
Kernel tests
TeamCleaner test
CsvImporter test
Functional tests
Configuration for Functional tests
Hello World page test
Hello World form test
Functional JavaScript tests
Time test
CsvImporter test
Summary
Chapter 18: Drupal Security
Cross-Site Scripting (XSS)
Sanitization methods in Drupal
Double escaping
SQL Injection
Cross-Site Request Forgery (CSRF)
Summary
Index
Other Books You May Enjoy


πŸ“œ SIMILAR VOLUMES


Drupal 10 Module Development: Develop an
✍ Daniel Sipos πŸ“‚ Library πŸ› Packt Publishing 🌐 English

<p><span>Build and customize powerful Drupal modules to extend your website's functionalities with this comprehensive guide</span></p><p><span>Purchase of the print or Kindle book includes a free PDF eBook</span></p><h4><span>Key Features</span></h4><ul><li><span><span>Explore the new features and i

Enterprise Drupal 8 Development: For Adv
✍ Todd Tomlinson (auth.) πŸ“‚ Library πŸ“… 2017 πŸ› Apress 🌐 English

<p>Successfully architect a Drupal 8 website that scales to meet project requirements of any size and scope. <br>Starting with a one-chapter review of Drupal basics, you'll dive into deeper topics including software development processes, architecting a Drupal site, scaling Drupal, working effective

Drupal 8 Module Development: Build and c
✍ Daniel Sipos πŸ“‚ Library πŸ“… 2017 πŸ› Packt Publishing Ltd 🌐 English

Learn to create and customize impressive Drupal 8 modules to extend your website's functionalities About This Book Unleash the power of Drupal 8 programming by creating efficient modules and extensions Explore a plethora of Drupal 8 APIs and get the best out of them using the power of PHP coding Lea

Drupal 8 Module Development: Build and c
✍ Daniel Sipos πŸ“‚ Library πŸ“… 2017 πŸ› Packt Publishing Ltd 🌐 English

Learn to create and customize impressive Drupal 8 modules to extend your website's functionalities About This Book Unleash the power of Drupal 8 programming by creating efficient modules and extensions Explore a plethora of Drupal 8 APIs and get the best out of them using the power of PHP coding Lea

Drupal 8 Module Development: Build and c
✍ Daniel Sipos πŸ“‚ Library πŸ“… 2017 πŸ› Packt Publishing - ebooks Account 🌐 English

<h4>Key Features</h4><ul><li>Unleash the power of Drupal 8 programming by creating efficient modules and extensions</li><li>Explore a plethora of Drupal 8 APIs and get the best out of them using the power of PHP coding</li><li>Learn to implement efficient data management and data security by creatin