public function DynamicLocalTasks::getDerivativeDefinitions in CiviCRM Entity 8.3
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/ DynamicLocalTasks.php, line 64
Class
- DynamicLocalTasks
- Generates moderation-related local tasks.
Namespace
Drupal\civicrm_entity\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
$civicrm_entities = array_filter($this->entityTypeManager
->getDefinitions(), function (EntityTypeInterface $type) {
return $type
->getProvider() == 'civicrm_entity' && $type
->get('civicrm_entity_ui_exposed');
});
foreach ($civicrm_entities as $entity_type_id => $entity_type) {
$this->derivatives["{$entity_type_id}.canonical"] = [
'route_name' => "entity.{$entity_type_id}.canonical",
'title' => $this
->t('View'),
'base_route' => "entity.{$entity_type_id}.canonical",
] + $base_plugin_definition;
$this->derivatives["{$entity_type_id}.edit_form"] = [
'route_name' => "entity.{$entity_type_id}.edit_form",
'title' => $this
->t('Edit'),
'base_route' => "entity.{$entity_type_id}.canonical",
] + $base_plugin_definition;
$this->derivatives["entity.{$entity_type_id}.collection"] = [
'route_name' => "entity.{$entity_type_id}.collection",
'title' => $this
->t('List'),
'base_route' => "entity.{$entity_type_id}.collection",
'weight' => -10,
] + $base_plugin_definition;
}
return $this->derivatives;
}