You are here

public function Tracker::getAvailableMenus in Menu Entity Index 8

Gets Menu Names, that are available for tracking.

Return value

array Menu Names available for tracking.

Overrides TrackerInterface::getAvailableMenus

2 calls to Tracker::getAvailableMenus()
Tracker::getTrackedMenus in src/Tracker.php
Gets menus configured for tracking.
Tracker::setTrackedMenus in src/Tracker.php
Sets menus to track and updates database table accordingly.

File

src/Tracker.php, line 175

Class

Tracker
Tracks menu links and their referenced entities.

Namespace

Drupal\menu_entity_index

Code

public function getAvailableMenus() {
  $options = [];
  $eids = $this->entityTypeManager
    ->getStorage('menu', 'AND')
    ->getQuery()
    ->execute();
  $menus = $this->entityTypeManager
    ->getStorage('menu')
    ->loadMultiple($eids);
  foreach ($menus as $name => $menu) {
    $options[$name] = $menu
      ->label();
  }
  asort($options);
  return $options;
}