function hook_page_top

Add a renderable array to the top of the page.

Parameters

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

Related topics

9 functions implement hook_page_top()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

BigPipeTestHooks::pageTop in core/modules/big_pipe/tests/modules/big_pipe_test/src/Hook/BigPipeTestHooks.php
Implements hook_page_top().
BlockHooks::pageTop in core/modules/block/src/Hook/BlockHooks.php
Implements hook_page_top().
LanguageTestHooks::pageTop in core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php
Implements hook_page_top().
NavigationHooks::pageTop in core/modules/navigation/src/Hook/NavigationHooks.php
Implements hook_page_top().
NodeThemeHooks::pageTop in core/modules/node/src/Hook/NodeThemeHooks.php
Implements hook_page_top().

... See full list

File

core/lib/Drupal/Core/Render/theme.api.php, line 1152

Code

function hook_page_top(array &$page_top) : void {
  $page_top['my_module'] = [
    '#markup' => 'This is the top.',
  ];
}

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