public function FormModeManagerLocalAction::getDerivativeDefinitions in Form mode manager 8
Same name and namespace in other branches
- 8.2 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 47
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);
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;
}