--- title: "Drupal" type: entity tags: [cms, php, enterprise, open-source] last_updated: 2026-05-01 --- ## Overview Drupal is an open-source enterprise CMS/CMF written in PHP, known for its flexibility and scalability. Primary use cases: enterprise platforms, complex content models, government/digital transformation projects, multilingual sites. ## Aliases - Drupal CMS - Drupal CMF ## Key Characteristics - **Complex content modeling**: Paragraphs, entity references, media library, field API, display modes - **Layout Builder**: Per-node layouts, layout templates, custom section and component types - **Configuration in code**: `drush cim/cex` (config import/export) — all config in YAML files - **Custom modules**: PHP attributes (Drupal 10+), hook system, routing YAML, service container - **Twig templating**: Template layer with preprocess hooks for data transformation - **Composer workflow**: `composer require`, patches, version pinning, `drush pm:security` - **Multilingual**: TMGMT translation module, language negotiation built-in ## Drupal Coding Patterns ### Custom Module Structure ``` my_module/ ├── my_module.info.yml ├── my_module.module ├── my_module.routing.yml ├── my_module.services.yml ├── my_module.permissions.yml ├── my_module.links.menu.yml └── src/ ├── Controller/ ├── Form/ ├── Plugin/Block/ └── EventSubscriber/ ``` ### Custom Block Plugin (Drupal 10+ PHP Attributes) ```php #[Block( id: 'my_custom_block', admin_label: new TranslatableMarkup('My Custom Block'), )] class MyBlock extends BlockBase { public function build(): array { return [ '#theme' => 'my_custom_block', '#attached' => ['library' => ['my_module/my-block']], '#cache' => ['max-age' => 3600], ]; } } ``` ### Hook Implementation ```php function my_module_node_access(EntityInterface $node, $op, AccountInterface $account) { if ($node->bundle() === 'case_study' && $op === 'view') { return $account->hasPermission('view case studies') ? AccessResult::allowed()->cachePerPermissions() : AccessResult::forbidden()->cachePerPermissions(); } return AccessResult::neutral(); } ``` ## Connections - [[CMSDeveloper]] uses Drupal as a primary CMS platform - [[ContentModel-first]] applies to Drupal content modeling before theme code - [[CodeOverConfiguration]] — Drupal config exported to YAML, not UI - [[LayoutBuilder]] is a Drupal-specific flexible content building system - [[TwigTemplating]] is Drupal's template engine ## Sources - [[engineering-cms-developer]]