Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NodeHooks1.php

function NodeHooks1::pageTop

Implements hook_page_top().

File

core/modules/node/src/Hook/NodeHooks1.php, line 268

Class

NodeHooks1
Hook implementations for node.

Namespace

Drupal\node\Hook

Code

public function pageTop(array &$page_top) : void {
    // 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')),
        ];
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal