You are here

public function MenuTokenContextManager::getUndiscoveredMenuDefinitions in Menu Token 8

Same name and namespace in other branches
  1. 9.1.x src/Service/MenuTokenContextManager.php \Drupal\menu_token\Service\MenuTokenContextManager::getUndiscoveredMenuDefinitions()

File

src/Service/MenuTokenContextManager.php, line 44

Class

MenuTokenContextManager
Menu token context manager service.

Namespace

Drupal\menu_token\Service

Code

public function getUndiscoveredMenuDefinitions() {

  // Get all custom menu links which should be rediscovered.
  $entity_ids = $this->entityTypeManager
    ->getStorage('menu_link_content')
    ->getQuery()
    ->condition('rediscover', FALSE)
    ->execute();
  $plugin_definitions = [];
  $menu_link_content_entities = $this->entityTypeManager
    ->getStorage('menu_link_content')
    ->loadMultiple($entity_ids);

  /** @var \Drupal\menu_link_content\MenuLinkContentInterface $menu_link_content */
  foreach ($menu_link_content_entities as $menu_link_content) {
    $plugin_definitions['menu_link_content:' . $menu_link_content
      ->uuid()] = $menu_link_content
      ->getPluginDefinition();
  }
  return $plugin_definitions;
}