class MenuLinkConfig in Config menu link 8
Same name in this branch
- 8 src/Entity/MenuLinkConfig.php \Drupal\menu_link_config\Entity\MenuLinkConfig
- 8 src/Plugin/Derivative/MenuLinkConfig.php \Drupal\menu_link_config\Plugin\Derivative\MenuLinkConfig
- 8 src/Plugin/Menu/MenuLinkConfig.php \Drupal\menu_link_config\Plugin\Menu\MenuLinkConfig
Hierarchy
- class \Drupal\menu_link_config\Plugin\Derivative\MenuLinkConfig implements ContainerDeriverInterface
Expanded class hierarchy of MenuLinkConfig
1 string reference to 'MenuLinkConfig'
File
- src/
Plugin/ Derivative/ MenuLinkConfig.php, line 14 - Contains \Drupal\menu_link_config\Plugin\Derivative\MenuLinkConfig.
Namespace
Drupal\menu_link_config\Plugin\DerivativeView source
class MenuLinkConfig implements ContainerDeriverInterface {
public function __construct(EntityTypeManagerInterface $entity_manager) {
$this->entityManager = $entity_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity_type.manager'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinition($derivative_id, $base_plugin_definition) {
if (!isset($this->derivatives)) {
$this
->getDerivativeDefinitions($base_plugin_definition);
}
if (isset($this->derivatives[$derivative_id])) {
return $this->derivatives[$derivative_id];
}
}
/**
* {@inheritdoc}
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MenuLinkConfig:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
MenuLinkConfig:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
MenuLinkConfig:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverInterface:: |
|
MenuLinkConfig:: |
public | function |