function template_preprocess_top_bar

Prepares variables for navigation top bar template.

Default template: top-bar.html.twig

Parameters

$variables: An associative array containing:

  • element: An associative array containing the properties and children of the top bar.

File

core/modules/navigation/navigation.module, line 34

Code

function template_preprocess_top_bar(&$variables) : void {
    $element = $variables['element'];
    foreach (TopBarRegion::cases() as $region) {
        $variables[$region->value] = $element[$region->value] ?? NULL;
    }
}

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