You are here

function template_preprocess_sitewide_alert in Sitewide Alert 8

Prepares variables for Sitewide Alert templates.

Default template: sitewide_alert.html.twig.

Parameters

array $variables: An associative array containing:

  • elements: An associative array containing the user information and any
  • attributes: HTML attributes for the containing element.

File

./sitewide_alert.page.inc, line 22
Contains sitewide_alert.page.inc.

Code

function template_preprocess_sitewide_alert(array &$variables) {

  // Fetch SitewideAlert Entity Object.
  $sitewide_alert = $variables['elements']['#sitewide_alert'];

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