Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: ECA: Event - Condition - Action 3.1.7 Minor update available for module eca (3.1.7). Release: ECA: Event - Condition - Action 3.0.15 Minor update available for module eca (3.0.15). Release: ECA: Event - Condition - Action 2.1.24 Minor update available for module eca (2.1.24). Release: Commerce Core 3.3.9 Minor update available for module commerce (3.3.9). Release: Modeler API 1.1.6 Minor update available for module modeler_api (1.1.6). Release: Commerce Shipping 3.0.4 Minor update available for module commerce_shipping (3.0.4). Release: TMGMT DeepL Integration 2.4.1 Minor update available for module tmgmt_deepl (2.4.1). Release: TMGMT DeepL Integration 2.3.0 Minor update available for module tmgmt_deepl (2.3.0). Module Revived: Optional End Date 2.0.0 Module optional_end_date updated after 7 months of inactivity (2.0.0). Usage Milestone: Shortcode Module shortcode crossed 1,000 active installs.

Lets other modules add extra Twig template names, including for content nested inside a parent (a menu inside a block, a field inside a form). Names use the values only, like core node--page.html.twig. This module does not rewrite #theme.

This is an API. It does not add suggestions on its own. A host module decides what to collect and which children inherit those names. Enable this module, then enable a host. Themes use the host, not this API.

Features

Basic function. A host collects values (for example a region footer_first). This module builds every combination and offers them as theme suggestions on the current hook, or on nested children while that host is rendering.

What enabling it adds.

  • ThemeSuggestionFrame plugins. A host names the preprocess hook and chooses which children inherit the collected values.
  • skip on a frame, so small hooks such as image or form_element do not inherit that parent. Providers that target those hooks still run.
  • ThemeSuggestionProvider plugins. A host adds one kind of value at a time (region, plugin id, node type). A provider can target theme hooks, frame classes, or both.
  • Every combination of collected values becomes a template name. Kind labels are not printed. You get menu--social--footer-first.html.twig, not a name that includes region.

When to use it. Use this when you are writing a host module (block, later form or paragraph) and you want extra template names without a custom preprocess in the theme.

Example use cases.

  • A block host that lets the menu inside a block use a different template by region and node type.
  • A later form host that lets input or form_element use a different template by form id.

Post-Installation

There is no settings page.

  1. Enable Theme Suggestions API.
  2. Enable a host module that uses this API.
  3. Add templates in your theme using the names the host documents.

Additional Requirements

  • Drupal 11.4 or later, or Drupal 12
  • PHP 8.3 or later (Drupal 12 sites already require PHP 8.5)

Similar projects

Entity Theme Suggestions is entity-only and unmaintained. This API works with any theme hook and is plugin-based.

Supporting this Module

File bug reports and feature requests in the issue queue.

Community Documentation

See the README in the Git repository for ThemeSuggestionFrame, ThemeSuggestionProvider, and how a host wires them.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Sep 2026
Latest release
6 hours ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.x-dev Dev 11 Sep 7, 2026