interface ThemeEngineInterface

Defines an interface for a theme engine.

A theme engine controls how to render a template.

Hierarchy

Expanded class hierarchy of ThemeEngineInterface

All classes that implement ThemeEngineInterface

2 files declare their use of ThemeEngineInterface
NyanCatThemeEngine.php in core/modules/system/tests/modules/nyan_cat/src/NyanCatThemeEngine.php
TwigThemeEngine.php in core/lib/Drupal/Core/Template/TwigThemeEngine.php

File

core/lib/Drupal/Core/Theme/ThemeEngineInterface.php, line 12

Namespace

Drupal\Core\Theme
View source
interface ThemeEngineInterface {
  
  /**
   * Registers templates that belong to the theme engine.
   *
   * @see hook_theme()
   */
  public function theme(array $existing, string $type, string $theme, string $path) : ?array;
  
  /**
   * Renders a template.
   *
   * @param string $template_file
   *   The name of the template to render, without the file extension.
   * @param array $variables
   *   A keyed array of variables that will appear in the output.
   *
   * @return string|\Drupal\Component\Render\MarkupInterface
   *   The output generated by the template, plus any debug information.
   */
  public function renderTemplate(string $template_file, array $variables) : string|MarkupInterface;

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ThemeEngineInterface::renderTemplate public function Renders a template. 2
ThemeEngineInterface::theme public function Registers templates that belong to the theme engine. 2

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