basePluginId = $base_plugin_id; $this->entityManager = $entity_manager; $this->stringTranslation = $string_translation; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( $base_plugin_id, $container->get('entity.manager'), $container->get('string_translation') ); } /** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $entity_types = $this->entityManager->getDefinitions(); $this->derivatives = []; foreach ($entity_types as $entity_type_id => $entity_type) { $this->derivatives[$entity_type_id] = [ 'id' => 'entity:' . $entity_type_id, 'provider' => 'views', 'title' => $entity_type->getLabel(), 'help' => $this->t('Validate @label', ['@label' => $entity_type->getLabel()]), 'entity_type' => $entity_type_id, 'class' => $base_plugin_definition['class'], ]; } return $this->derivatives; } }