navigation.module
Same filename in other branches
File
-
core/
modules/ navigation/ navigation.module
View source
<?php
/**
* @file
*/
use Drupal\navigation\TopBarRegion;
/**
* Implements hook_module_implements_alter().
*/
function navigation_module_implements_alter(&$implementations, $hook) : void {
if ($hook == 'page_top') {
$group = $implementations['navigation'];
unset($implementations['navigation']);
$implementations['navigation'] = $group;
}
if ($hook == 'help') {
// We take over the layout_builder hook_help().
unset($implementations['layout_builder']);
}
}
/**
* 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 |
---|---|---|
navigation_module_implements_alter | Implements hook_module_implements_alter(). | |
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.