function NavigationRenderer::buildTopBar
Build the top bar for content entity pages.
Parameters
array $page_top: A renderable array representing the top of the page.
See also
navigation_page_top()
File
-
core/
modules/ navigation/ src/ NavigationRenderer.php, line 216
Class
- NavigationRenderer
- Handle rendering for different pieces of the navigation.
Namespace
Drupal\navigationCode
public function buildTopBar(array &$page_top) : void {
if (!$this->moduleHandler
->moduleExists('navigation_top_bar')) {
return;
}
$page_top['top_bar'] = [
'#type' => 'top_bar',
'#access' => $this->currentUser
->hasPermission('access navigation'),
'#cache' => [
'keys' => [
'top_bar',
],
'contexts' => [
'user.permissions',
],
],
];
}