Modernize Your Code
The rest of these docs teach Drupal as it works today: hooks as classes, plugins as attributes, services injected through constructors. This section is for the other direction. If you maintain a module or theme written against an older Drupal, here is how to bring it forward, one pattern at a time, without rewriting it.
Each guide is a focused conversion: what the legacy form looks like, what the current form looks like, and the mechanical steps between them. You do not need to do them all at once, and an old module keeps working while you convert it piece by piece.
Where this fits
Section titled “Where this fits”These guides cover pattern-level modernization within Drupal 11: the same code, written the current way. They do not cover upgrading between major versions (the Composer and database update mechanics of moving a site from Drupal 10 to 11). For that, run the Upgrade Status module to see what blocks the upgrade, and follow the drupal.org upgrade guide.
Each conversion here is also one that drupal-rector automates for many cases. The guides show what the tool does, so you can review its output and finish what it leaves.
If you are writing something new rather than converting something old, you do not need this section at all. Follow the module and theming guides, which lead with the current patterns from the first line.
AI coding agents frequently emit the legacy forms these guides convert, because their training skews toward older Drupal. Where AI agents get Drupal wrong maps each one to the gate that catches it.
Was this page helpful?
Drupal is a registered trademark of Dries Buytaert.