entityTypeManager = $entity_type_manager; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static($container->get('entity_type.manager')); } /** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { if (!$this->derivatives) { foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { $handlers = $entity_type->getHandlerClasses(); if (isset($handlers['local_action_provider'])) { foreach ($handlers['local_action_provider'] as $class) { /** @var \Drupal\entity\Menu\EntityLocalActionProviderInterface $handler */ $handler = $this->entityTypeManager->createHandlerInstance($class, $entity_type); $this->derivatives += $handler->buildLocalActions($entity_type); } } } } return $this->derivatives; } }