function HtmlRenderer::buildPageTopAndBottom
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php \Drupal\Core\Render\MainContent\HtmlRenderer::buildPageTopAndBottom()
- 10 core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php \Drupal\Core\Render\MainContent\HtmlRenderer::buildPageTopAndBottom()
- 9 core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php \Drupal\Core\Render\MainContent\HtmlRenderer::buildPageTopAndBottom()
- 8.9.x core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php \Drupal\Core\Render\MainContent\HtmlRenderer::buildPageTopAndBottom()
Invokes the page top and bottom hooks.
@internal
Parameters
array &$html: A #type 'html' render array, for which the page top and bottom hooks will be invoked, and to which the 'page_top' and 'page_bottom' children (also render arrays) will be added (if non-empty).
array $page_top: (optional) The render array representing the initial page top content.
array $page_bottom: (optional) The render array representing the initial page bottom content.
Throws
\LogicException
See also
1 call to HtmlRenderer::buildPageTopAndBottom()
- HtmlRenderer::renderResponse in core/
lib/ Drupal/ Core/ Render/ MainContent/ HtmlRenderer.php - The entire HTML: takes a #type 'page' and wraps it in a #type 'html'.
File
-
core/
lib/ Drupal/ Core/ Render/ MainContent/ HtmlRenderer.php, line 353
Class
- HtmlRenderer
- Default main content renderer for HTML requests.
Namespace
Drupal\Core\Render\MainContentCode
public function buildPageTopAndBottom(array &$html, array $page_top = [], array $page_bottom = []) {
// Modules can add render arrays to the top and bottom of the page.
$this->moduleHandler
->invokeAllWith('page_top', function (callable $hook, string $module) use (&$page_top) {
$hook($page_top);
});
$this->moduleHandler
->invokeAllWith('page_bottom', function (callable $hook, string $module) use (&$page_bottom) {
$hook($page_bottom);
});
if (!empty($page_top)) {
$html['page_top'] = $page_top;
}
if (!empty($page_bottom)) {
$html['page_bottom'] = $page_bottom;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.