function hook_extension

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/theme.api.php \hook_extension()
  2. 10 core/lib/Drupal/Core/Render/theme.api.php \hook_extension()
  3. 11.x core/lib/Drupal/Core/Render/theme.api.php \hook_extension()

Declare a template file extension to be used with a theme engine.

This hook is used in a theme engine implementation in the format of ENGINE_extension().

Return value

string The file extension the theme engine will recognize.

Related topics

2 functions implement hook_extension()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

nyan_cat_extension in core/modules/system/tests/themes/engines/nyan_cat/nyan_cat.engine
Implements hook_extension().
twig_extension in core/themes/engines/twig/twig.engine
Implements hook_extension().

File

core/lib/Drupal/Core/Render/theme.api.php, line 763

Code

function hook_extension() {
    // Extension for template base names in Twig.
    return '.html.twig';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.