function DynamicLocalTasks::getDerivativeDefinitions
Same name in this branch
- 8.9.x core/modules/media/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\media\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
Same name in other branches
- 9 core/modules/media/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\media\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
- 9 core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\content_moderation\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
- 10 core/modules/media/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\media\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
- 10 core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\content_moderation\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
- 11.x core/modules/media/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\media\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
- 11.x core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\content_moderation\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
Overrides DeriverBase::getDerivativeDefinitions
File
-
core/
modules/ content_moderation/ src/ Plugin/ Derivative/ DynamicLocalTasks.php, line 76
Class
- DynamicLocalTasks
- Generates moderation-related local tasks.
Namespace
Drupal\content_moderation\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
$latest_version_entities = array_filter($this->entityTypeManager
->getDefinitions(), function (EntityTypeInterface $type) {
return $this->moderationInfo
->canModerateEntitiesOfEntityType($type) && $type->hasLinkTemplate('latest-version');
});
foreach ($latest_version_entities as $entity_type_id => $entity_type) {
$this->derivatives["{$entity_type_id}.latest_version_tab"] = [
'route_name' => "entity.{$entity_type_id}.latest_version",
'title' => $this->t('Latest version'),
'base_route' => "entity.{$entity_type_id}.canonical",
'weight' => 1,
] + $base_plugin_definition;
}
return $this->derivatives;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.