W3cubDocs

/Drupal 8

function node_page_top

node_page_top(array &$page)

Implements hook_page_top().

File

core/modules/node/node.module, line 805
The core module that allows content to be submitted to the site.

Code

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

    $form = \Drupal::formBuilder()->getForm('\Drupal\node\Form\NodePreviewForm', $route_match->getParameter('node_preview'));
    $page['page_top']['node_preview']['view_mode'] = $form;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!node!node.module/function/node_page_top/8.1.x