function node_page_top

Same name in other branches
  1. 9 core/modules/node/node.module \node_page_top()
  2. 8.9.x core/modules/node/node.module \node_page_top()

Implements hook_page_top().

File

core/modules/node/node.module, line 764

Code

function node_page_top(array &$page_top) {
    // Add 'Back to content editing' link on preview page.
    $route_match = \Drupal::routeMatch();
    if ($route_match->getRouteName() == 'entity.node.preview') {
        $page_top['node_preview'] = [
            '#type' => 'container',
            '#attributes' => [
                'class' => [
                    'node-preview-container',
                    'container-inline',
                ],
            ],
            'view_mode' => \Drupal::formBuilder()->getForm(NodePreviewForm::class, $route_match->getParameter('node_preview')),
        ];
    }
}

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