public function ReplicateUILocalTasks::getDerivativeDefinitions in Replicate UI 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/ ReplicateUILocalTasks.php, line 53
Class
Namespace
Drupal\replicate_ui\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$config = $this->configFactory
->get('replicate_ui.settings');
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type instanceof ContentEntityTypeInterface && in_array($entity_type_id, $config
->get('entity_types')) && $entity_type
->hasLinkTemplate('canonical')) {
$replicate_route_name = "entity.{$entity_type_id}.replicate";
$base_route_name = "entity.{$entity_type_id}.canonical";
$this->derivatives[$replicate_route_name] = [
'entity_type' => $entity_type_id,
'title' => $this
->t('Replicate'),
'route_name' => $replicate_route_name,
'base_route' => $base_route_name,
] + $base_plugin_definition;
}
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}