navigation.module

Same filename and directory in other branches
  1. 10 core/modules/navigation/navigation.module

File

core/modules/navigation/navigation.module

View source
<?php


/**
 * @file
 */

use Drupal\navigation\TopBarRegion;

/**
 * Prepares variables for navigation top bar template.
 *
 * Default template: top-bar.html.twig
 *
 * @param array $variables
 *   An associative array containing:
 *    - element: An associative array containing the properties and children of
 *      the top bar.
 */
function template_preprocess_top_bar(&$variables) : void {
  $element = $variables['element'];
  foreach (TopBarRegion::cases() as $region) {
    $variables[$region->value] = $element[$region->value] ?? NULL;
  }
}

Functions

Title Deprecated Summary
template_preprocess_top_bar Prepares variables for navigation top bar template.

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