function NavigationHooks::pageTop

Implements hook_page_top().

Attributes

#[Hook('page_top', order: Order::Last)]

File

core/modules/navigation/src/Hook/NavigationHooks.php, line 83

Class

NavigationHooks
Hook implementations for navigation.

Namespace

Drupal\navigation\Hook

Code

public function pageTop(array &$page_top) : void {
  if (!$this->currentUser
    ->hasPermission('access navigation')) {
    return;
  }
  $this->navigationRenderer
    ->removeToolbar($page_top);
  $this->navigationRenderer
    ->buildNavigation($page_top);
  $this->navigationRenderer
    ->buildTopBar($page_top);
}

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