public function RevisionsLocalTask::getDerivativeDefinitions in Workspace 8
Gets the definition of all derivatives of a base plugin.
Parameters
array $base_plugin_definition: The definition array of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative id.
Overrides DeriverBase::getDerivativeDefinitions
See also
getDerivativeDefinition()
1 method overrides RevisionsLocalTask::getDerivativeDefinitions()
- RevisionsContextual::getDerivativeDefinitions in src/
Plugin/ Derivative/ RevisionsContextual.php - Gets the definition of all derivatives of a base plugin.
File
- src/
Plugin/ Derivative/ RevisionsLocalTask.php, line 52
Class
- RevisionsLocalTask
- Provides local task definitions for all entity bundles.
Namespace
Drupal\workspace\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type
->hasLinkTemplate('version-tree')) {
$this->derivatives[$entity_type_id] = [
'route_name' => "entity.{$entity_type_id}.version_tree",
'title' => $this
->t('Tree'),
'base_route' => "entity.{$entity_type_id}.canonical",
'weight' => 20,
];
}
}
foreach ($this->derivatives as &$derivative) {
$derivative += $base_plugin_definition;
}
return $this->derivatives;
}