Class EntityCloneContextualLinks
@package Drupal\entity_clone\Plugin\Derivative
Hierarchy
- class \Drupal\entity_clone\Plugin\Derivative\EntityCloneContextualLinks extends \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface
Expanded class hierarchy of EntityCloneContextualLinks
1 string reference to 'EntityCloneContextualLinks'
Fichier
-
src/
Plugin/ Derivative/ EntityCloneContextualLinks.php, line 16
Namespace
Drupal\entity_clone\Plugin\DerivativeView source
class EntityCloneContextualLinks extends DeriverBase implements ContainerDeriverInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The translation manager.
*
* @var \Drupal\Core\StringTranslation\TranslationManager
*/
protected $translationManager;
/**
* Constructs a new EntityCloneContextualLinks.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager.
* @param \Drupal\Core\StringTranslation\TranslationManager $stringTranslation
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager, TranslationManager $stringTranslation) {
$this->entityTypeManager = $entityTypeManager;
$this->translationManager = $stringTranslation;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container->get('entity_type.manager'), $container->get('string_translation'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
// Create contextual links for entity clone.
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
$this->derivatives["{$entity_type_id}.clone_tab"] = [
'route_name' => "entity.{$entity_type_id}.clone_form",
'title' => $this->translationManager
->translate('Clone'),
'group' => $entity_type_id,
];
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Members
Titre Trier par ordre décroissant | Modifiers | Object type | Résumé |
---|---|---|---|
EntityCloneContextualLinks::$entityTypeManager | protected | property | The entity type manager. |
EntityCloneContextualLinks::$translationManager | protected | property | The translation manager. |
EntityCloneContextualLinks::create | public static | function | |
EntityCloneContextualLinks::getDerivativeDefinitions | public | function | |
EntityCloneContextualLinks::__construct | public | function | Constructs a new EntityCloneContextualLinks. |