You are here

function ultimenu_page_bottom in Ultimenu 8

Same name and namespace in other branches
  1. 8.2 ultimenu.module \ultimenu_page_bottom()

Implements hook_page_bottom().

File

./ultimenu.module, line 93
Build Ultimenu blocks based on menu, and their regions on enabled menu items.

Code

function ultimenu_page_bottom(array &$page_bottom) {

  // Add a dedicated button toggle for main menu to the page_bottom region.
  $theme = \Drupal::theme()
    ->getActiveTheme()
    ->getName();
  $theme_default = \Drupal::config('system.theme')
    ->get('default');
  if ($theme_default == $theme) {
    $label = t('Menu');
    $button = '<button data-ultimenu-button="#ultimenu-main" class="button button--ultimenu"
      aria-label="' . $label . '" value="' . $label . '"><span class="bars">' . $label . '</span></button>';
    $page_bottom['ultimenu_button']['#markup'] = $button;
    $page_bottom['ultimenu_button']['#allowed_tags'] = [
      'button',
      'span',
    ];
  }
}