function hook_page_top

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Render/theme.api.php \hook_page_top()
  2. 8.9.x core/lib/Drupal/Core/Render/theme.api.php \hook_page_top()
  3. 11.x core/lib/Drupal/Core/Render/theme.api.php \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

18 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().
big_pipe_test_page_top in core/modules/big_pipe/tests/modules/big_pipe_test/big_pipe_test.module
Implements hook_page_top().
BlockHooks::pageTop in core/modules/block/src/Hook/BlockHooks.php
Implements hook_page_top().
block_page_top in core/modules/block/block.module
Implements hook_page_top().
LanguageTestHooks::pageTop in core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php
Implements hook_page_top().

... See full list

File

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

Code

function hook_page_top(array &$page_top) {
  $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.