public function FormModeManagerLocalAction::getDerivativeDefinitions in Form mode manager 8.2
Same name and namespace in other branches
- 8 src/Plugin/Derivative/FormModeManagerLocalAction.php \Drupal\form_mode_manager\Plugin\Derivative\FormModeManagerLocalAction::getDerivativeDefinitions()
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/ FormModeManagerLocalAction.php, line 72
Class
- FormModeManagerLocalAction
- Provides local action definitions for all entity bundles.
Namespace
Drupal\form_mode_manager\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
$form_modes_definitions = $this->formModeManager
->getAllFormModesDefinitions();
foreach ($form_modes_definitions as $entity_type_id => $form_modes) {
foreach ($form_modes as $form_mode_name => $form_mode) {
if ($this->formModeManager
->hasActiveFormMode($entity_type_id, $form_mode_name)) {
$this
->setDefaultLocalTask($form_mode, $entity_type_id, $form_mode_name);
// @TODO Use EntityRoutingMap to retrieve route_name,
// of admin_create operation.
if ($this
->isUserEntityType($entity_type_id)) {
$this->derivatives[$form_mode['id']]['route_name'] = "user.admin_create.{$form_mode_name}";
unset($this->derivatives[$form_mode['id']]['route_parameters']);
}
$this
->setNodeEntityType($form_mode, $entity_type_id);
$this
->setMediaEntityType($form_mode, $entity_type_id);
$this
->setTaxonomyTermEntityType($form_mode, $entity_type_id);
}
}
}
return $this->derivatives;
}