You are here

public function MenuLinkConfig::getDerivativeDefinitions in Config menu link 8

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverInterface::getDerivativeDefinitions

See also

getDerivativeDefinition()

1 call to MenuLinkConfig::getDerivativeDefinitions()
MenuLinkConfig::getDerivativeDefinition in src/Plugin/Derivative/MenuLinkConfig.php
Gets the definition of a derivative plugin.

File

src/Plugin/Derivative/MenuLinkConfig.php, line 42
Contains \Drupal\menu_link_config\Plugin\Derivative\MenuLinkConfig.

Class

MenuLinkConfig

Namespace

Drupal\menu_link_config\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $links = [];

  // Get all menu link config entities.
  $entities = $this->entityManager
    ->getStorage('menu_link_config')
    ->loadMultiple(NULL);
  foreach ($entities as $id => $menu_link_config) {

    /** @var \Drupal\menu_link_config\MenuLinkConfigInterface $menu_link_config */
    $links[$id] = $menu_link_config
      ->getPluginDefinition() + $base_plugin_definition;
  }
  return $links;
}