You are here

function template_preprocess_config_pages in Config Pages 8

Same name and namespace in other branches
  1. 8.3 config_pages.module \template_preprocess_config_pages()
  2. 8.2 config_pages.module \template_preprocess_config_pages()

Prepares variables for config page templates.

Default template: config-pages.html.twig.

Parameters

array $variables: An associative array containing:

  • elements: An array of elements to display in view mode.
  • config_pages: The config_pages object.
  • view_mode: View mode; e.g., 'full', 'teaser'...

File

./config_pages.module, line 103
Module hooks.

Code

function template_preprocess_config_pages(&$variables) {
  $variables['view_mode'] = $variables['elements']['#view_mode'];
  $variables['config_pages'] = $variables['elements']['#config_pages'];

  // Helpful $content variable for templates.
  $variables += array(
    'content' => [],
  );
  foreach (Element::children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }
}