About this book
This book is a quick reference for developers creating Drupal sites. While working on such sites during my career, I have gathered a large collection of notes and code which I use for my reference. I hope it will be useful for you, too.
During my hunting through examples on Drupal.org, Stack Overflow and many other places, I often wished there was a succinct set of current annotated code samples explaining how to do things the Drupal way. Of course, there is the excellent examples module, which is very handy. This book is meant to otherwise fill that gap. Please forgive the todo
items, but I've found that if I want to get it perfect, it won't ever get published.
You are invited to contribute (in the open source way) by making edits and pull requests at this link on Github. There is a very simple online editor which automatically forks the repo and lets you type your changes directly in your browser in markdown format. Try it by editing a chapter of interest to you. And while you are here, see who else contributed to the masterpiece 😉
If you are inspired, please be a part of this project by contributing your own thoughts, code snippets, tutorials, links etc. (Imposters are welcomed!) Add your name on the attribution page. Either add a note in the comment form at the bottom of each page or click the Edit this page on GitHub
also at the very bottom of any page and start editing. You don't need to know Git.
If you want to contribute to the expense of creating this book, I have added a leanpub version which you can purchase. It contains the same data as this site although this site will be more up to date due to my process of putting the data here first. Thanks!
- Batch and Queue - Batch API
- Blocks - Generate the code to create blocks, dependency injection, blocks with config forms, block permissions
- Caching - Cache tags, disabling caching, caching REST resources, development setup, various caching tips
- Composer, updates and patches
- Config - Creating, loading, overriding, drush config commands
- Cron - Using hook_cron, sample crontab files, how to stop cron
- Dates - Getting and setting date fields, date arithmetic, expiration, node creation and changed dates, Smart date module
- Debugging with PhpStorm, DDEV and Xdebug
- Development - Local setup, creating sites, DDEV, troubleshooting, PHPStorm setup, Xdebug setup, Twig debugging
- Drush - the amazing command line tool that makes everyone's life so much better
- Email - Sending emails in Drupal
- Entities - More entities - the primary building blocks of Drupal
- Forms - Creating and modifying forms using the Form API, AJAX forms, modals
- General - Useful things that seemed to not fit well elsewhere
- Getting off the island - Reaching out of Drupal into the wider web
- Hooks - hooking into the Drupal hook system to make modifications
- Learning and keeping up with the latest on Drupal
- Links, Aliases and URLs
- Logging and notification
- Menus
- Migration - automated ways to get data into Drupal
- Modal dialogs
- Modules - a collection of useful and essential
- Nodes and Fields - Loading and saving nodes and different types of fields, multivalue field magic, link fields, entity reference fields, url fields, storing JSON data into text fields, paragraphs, great cheat sheets
- PHP - Tips and tricks
- Queries - entityQueries, SQL queries, inserting and deleting content
- Redirects
- Render Arrays
- Routes and Controllers
- Security
- Services and Dependency injection
- Setup your mac for Drupal development
- State API, Tempstore and UserData (Interesting flavors of storage)
- Taxonomy
- Testing with PHPUnit and Drupal Test Traits
- Twig - Formatting and controlling your output
- Upgrading and patching Drupal and contrib modules
More coming on these topics
- Events
- Custom Plugins
- Media image files
- Migration
- Paragraphs
- Single sign on
- Views