public function EntityTasksDeriver::getDerivativeDefinitions in Entity API 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()
File
- src/
Plugin/ Derivative/ EntityTasksDeriver.php, line 42
Class
- EntityTasksDeriver
- Derives local tasks for entity types.
Namespace
Drupal\entity\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
if (!$this->derivatives) {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
$handlers = $entity_type
->getHandlerClasses();
if (isset($handlers['local_task_provider'])) {
foreach ($handlers['local_task_provider'] as $class) {
/** @var \Drupal\entity\Menu\EntityLocalTaskProviderInterface $handler */
$handler = $this->entityTypeManager
->createHandlerInstance($class, $entity_type);
$this->derivatives += $handler
->buildLocalTasks($entity_type);
}
}
}
}
return $this->derivatives;
}