public function RevisionsContextual::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 RevisionsLocalTask::getDerivativeDefinitions
See also
getDerivativeDefinition()
File
- src/
Plugin/ Derivative/ RevisionsContextual.php, line 15
Class
- RevisionsContextual
- Provides contextual link 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'),
'group' => $entity_type_id,
'weight' => 20,
];
}
}
foreach ($this->derivatives as &$derivative) {
$derivative += $base_plugin_definition;
}
return $this->derivatives;
}