function MenuLinkContentDeriver::getDerivativeDefinitions

Same name in other branches
  1. 8.9.x core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php \Drupal\menu_link_content\Plugin\Deriver\MenuLinkContentDeriver::getDerivativeDefinitions()
  2. 10 core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php \Drupal\menu_link_content\Plugin\Deriver\MenuLinkContentDeriver::getDerivativeDefinitions()
  3. 11.x core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php \Drupal\menu_link_content\Plugin\Deriver\MenuLinkContentDeriver::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php, line 59

Class

MenuLinkContentDeriver
Provides a deriver for user entered paths of menu links.

Namespace

Drupal\menu_link_content\Plugin\Deriver

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    // Get all custom menu links which should be rediscovered.
    $entity_ids = $this->entityTypeManager
        ->getStorage('menu_link_content')
        ->getQuery()
        ->accessCheck(FALSE)
        ->condition('rediscover', TRUE)
        ->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->uuid()] = $menu_link_content->getPluginDefinition();
    }
    return $plugin_definitions;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.