protected MenuParentFormSelector::getMenuOptions(array $menu_names = NULL)
Gets a list of menu names for use as options.
array $menu_names: (optional) Array of menu names to limit the options, or NULL to load all.
array Keys are menu names (ids) values are the menu labels.
protected function getMenuOptions(array $menu_names = NULL) { $menus = $this->entityManager->getStorage('menu')->loadMultiple($menu_names); $options = array(); /** @var \Drupal\system\MenuInterface[] $menus */ foreach ($menus as $menu) { $options[$menu->id()] = $menu->label(); } return $options; }
© 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!lib!Drupal!Core!Menu!MenuParentFormSelector.php/function/MenuParentFormSelector::getMenuOptions/8.1.x