public function RevisionsOverviewDeriver::getDerivativeDefinitions in Entity API 8.0
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()
File
- src/
Plugin/ Derivative/ RevisionsOverviewDeriver.php, line 48 - Contains \Drupal\entity\Plugin\Derivative\RevisionsOverviewDeriver.
Class
- RevisionsOverviewDeriver
- Provides local tasks for the revision overview.
Namespace
Drupal\entity\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$exclude = [
'node',
];
$this->derivatives = [];
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if (in_array($entity_type_id, $exclude)) {
continue;
}
if (!$entity_type
->hasLinkTemplate('version-history')) {
continue;
}
$this->derivatives[$entity_type_id] = [
'route_name' => "entity.{$entity_type_id}.version_history",
'title' => 'Revisions',
'base_route' => "entity.{$entity_type_id}.edit_form",
'weight' => 20,
] + $base_plugin_definition;
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}