class ScheduledTransitionsLocalTasks in Scheduled Transitions 8
Same name and namespace in other branches
- 2.x src/Plugin/Derivative/ScheduledTransitionsLocalTasks.php \Drupal\scheduled_transitions\Plugin\Derivative\ScheduledTransitionsLocalTasks
Scheduled transitions tab for entities.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\scheduled_transitions\Plugin\Derivative\ScheduledTransitionsLocalTasks implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of ScheduledTransitionsLocalTasks
1 string reference to 'ScheduledTransitionsLocalTasks'
File
- src/
Plugin/ Derivative/ ScheduledTransitionsLocalTasks.php, line 18
Namespace
Drupal\scheduled_transitions\Plugin\DerivativeView source
class ScheduledTransitionsLocalTasks extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The base plugin ID.
*
* @var string
*/
protected $basePluginId;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Creates a new ScheduledTransitionsLocalTask.
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* Entity type manager.
*/
public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager) {
$this->basePluginId = $base_plugin_id;
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($base_plugin_id, $container
->get('entity_type.manager'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
foreach ($this->entityTypeManager
->getDefinitions() as $entityType) {
if ($entityType
->hasLinkTemplate(ScheduledTransitionsRouteProvider::LINK_TEMPLATE)) {
$entityTypeId = $entityType
->id();
$this->derivatives["{$entityTypeId}.scheduled_transitions"] = [
'class' => ScheduledTransitionsLocalTask::class,
'route_name' => ScheduledTransitionsRouteProvider::getScheduledTransitionRouteName($entityType),
// Title is overridden by class.
'title' => $this
->t('Scheduled transitions'),
'base_route' => "entity.{$entityTypeId}.canonical",
// Weight it after nodes' Edit, Delete, Versions.
'weight' => 30,
] + $base_plugin_definition;
}
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
ScheduledTransitionsLocalTasks:: |
protected | property | The base plugin ID. | |
ScheduledTransitionsLocalTasks:: |
protected | property | The entity type manager. | |
ScheduledTransitionsLocalTasks:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
ScheduledTransitionsLocalTasks:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
ScheduledTransitionsLocalTasks:: |
public | function | Creates a new ScheduledTransitionsLocalTask. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |