function NavigationRenderer::buildNavigation

Same name in other branches
  1. 10 core/modules/navigation/src/NavigationRenderer.php \Drupal\navigation\NavigationRenderer::buildNavigation()

Build out the navigation bar.

Parameters

array $page_top: A renderable array representing the top of the page.

See also

toolbar_page_top()

hook_page_top()

File

core/modules/navigation/src/NavigationRenderer.php, line 107

Class

NavigationRenderer
Handle rendering for different pieces of the navigation.

Namespace

Drupal\navigation

Code

public function buildNavigation(array &$page_top) : void {
    $page_top['navigation'] = [
        '#cache' => [
            'keys' => [
                'navigation',
                'navigation',
            ],
            'max-age' => CacheBackendInterface::CACHE_PERMANENT,
        ],
        '#pre_render' => [
            'navigation.renderer:doBuildNavigation',
        ],
    ];
}

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