entityManager = $entity_manager; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( $container->get('entity.manager') ); } /** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { $has_canonical = $entity_type->hasLinkTemplate('canonical'); if ($has_canonical) { $this->derivatives[$entity_type_id] = $base_plugin_definition; $this->derivatives[$entity_type_id]['id'] = $base_plugin_definition['id'] . ':' . $entity_type_id; $this->derivatives[$entity_type_id]['label'] = $entity_type->getLabel(); $this->derivatives[$entity_type_id]['target_entity'] = $entity_type_id; $this->derivatives[$entity_type_id]['base_plugin_label'] = (string) $base_plugin_definition['label']; } } return parent::getDerivativeDefinitions($base_plugin_definition); } }