You are here

function render_example_theme in Examples for Developers 8

Same name and namespace in other branches
  1. 7 render_example/render_example.module \render_example_theme()
  2. 3.x modules/render_example/render_example.module \render_example_theme()

Implements hook_theme().

Related topics

File

render_example/render_example.module, line 71
Demonstrates using Drupal's Render API.

Code

function render_example_theme() {
  return [
    // These theme hooks are both used by examples in
    // \Drupal\render_example\Controller\RenderExampleController::arrays().
    'render_example_add_div' => [
      'render element' => 'element',
    ],
    'render_array' => [
      'render element' => 'element',
    ],
    // This is used in combination with \Drupal\render_example\Element\Marquee
    // to define a new custom render element type that allows for the use of
    // '#type' => 'marquee' elements in a render array.
    'render_example_marquee' => [
      'variables' => [
        'content' => '',
        'attributes' => [],
      ],
    ],
  ];
}