function block_page_top

block_page_top(array &$page_top)

Implements hook_page_top().

File

core/modules/block/block.module, line 66
Controls the visual building blocks a page is constructed with.

Code

function block_page_top(array &$page_top) {
  if (\Drupal::routeMatch()->getRouteName() === 'block.admin_demo') {
    $theme = \Drupal::theme()->getActiveTheme()->getName();
    $page_top['backlink'] = array(
      '#type' => 'link',
      '#title' => t('Exit block region demonstration'),
      '#options' => array('attributes' => array('class' => array('block-demo-backlink'))),
      '#weight' => -10,
    );
    if (\Drupal::config('system.theme')->get('default') == $theme) {
      $page_top['backlink']['#url'] = Url::fromRoute('block.admin_display');
    }
    else {
      $page_top['backlink']['#url'] = Url::fromRoute('block.admin_display_theme', ['theme' => $theme]);
    }
  }
}

© 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!block!block.module/function/block_page_top/8.1.x