You are here

function bibcite_entity_page_top in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/bibcite_entity.module \bibcite_entity_page_top()

Implements hook_page_top().

File

modules/bibcite_entity/bibcite_entity.module, line 499
Module hooks.

Code

function bibcite_entity_page_top(array &$page) {

  // Add 'Back to content editing' link on preview page.
  $route_match = \Drupal::routeMatch();
  if ($route_match
    ->getRouteName() == 'entity.bibcite_reference.preview') {
    $page['page_top']['bibcite_reference_preview'] = [
      '#type' => 'container',
      '#attributes' => [
        'class' => [
          'reference-preview-container',
          'container-inline',
        ],
      ],
    ];
    $form = \Drupal::formBuilder()
      ->getForm(ReferencePreviewForm::class, $route_match
      ->getParameter('bibcite_reference_preview'));
    $page['page_top']['bibcite_reference_preview']['view_mode'] = $form;
  }
}