You are here

public function UltimenuManager::getMenus in Ultimenu 8

Same name and namespace in other branches
  1. 8.2 src/UltimenuManager.php \Drupal\ultimenu\UltimenuManager::getMenus()

Returns the available menus, excluding some admin menus.

Return value

array The menus.

Overrides UltimenuManagerInterface::getMenus

1 call to UltimenuManager::getMenus()
UltimenuManager::getUltimenuBlocks in src/UltimenuManager.php
Returns the Ultimenu blocks.

File

src/UltimenuManager.php, line 188

Class

UltimenuManager
Manages Ultimenu plugin.

Namespace

Drupal\ultimenu

Code

public function getMenus() {
  if (!isset($this->menuOptions)) {
    if ($custom_menus = Menu::loadMultiple()) {
      foreach ($custom_menus as $menu_name => $menu) {
        $custom_menus[$menu_name] = Html::escape($menu
          ->label());
      }
    }
    $exclude_menus = [
      'admin' => $this
        ->t('Administration'),
      'devel' => $this
        ->t('Development'),
      'tools' => $this
        ->t('Tools'),
    ];
    $this->menuOptions = array_diff_key($custom_menus, $exclude_menus);
    asort($this->menuOptions);
  }
  return $this->menuOptions;
}