function FieldUiLocalTask::alterLocalTasks
Same name in other branches
- 9 core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php \Drupal\field_ui\Plugin\Derivative\FieldUiLocalTask::alterLocalTasks()
- 8.9.x core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php \Drupal\field_ui\Plugin\Derivative\FieldUiLocalTask::alterLocalTasks()
- 11.x core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php \Drupal\field_ui\Plugin\Derivative\FieldUiLocalTask::alterLocalTasks()
Alters the base_route definition for field_ui local tasks.
Parameters
array $local_tasks: An array of local tasks plugin definitions, keyed by plugin ID.
File
-
core/
modules/ field_ui/ src/ Plugin/ Derivative/ FieldUiLocalTask.php, line 181
Class
- FieldUiLocalTask
- Provides local task definitions for all entity bundles.
Namespace
Drupal\field_ui\Plugin\DerivativeCode
public function alterLocalTasks(&$local_tasks) {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($route_name = $entity_type->get('field_ui_base_route')) {
$local_tasks["field_ui.fields:overview_{$entity_type_id}"]['base_route'] = $route_name;
$local_tasks["field_ui.fields:form_display_overview_{$entity_type_id}"]['base_route'] = $route_name;
$local_tasks["field_ui.fields:display_overview_{$entity_type_id}"]['base_route'] = $route_name;
$local_tasks["field_ui.fields:field_form_display_default_{$entity_type_id}"]['base_route'] = $route_name;
$local_tasks["field_ui.fields:field_display_default_{$entity_type_id}"]['base_route'] = $route_name;
foreach ($this->entityDisplayRepository
->getFormModes($entity_type_id) as $form_mode => $form_mode_info) {
$local_tasks['field_ui.fields:field_form_display_' . $form_mode . '_' . $entity_type_id]['base_route'] = $route_name;
}
foreach ($this->entityDisplayRepository
->getViewModes($entity_type_id) as $view_mode => $form_mode_info) {
$local_tasks['field_ui.fields:field_display_' . $view_mode . '_' . $entity_type_id]['base_route'] = $route_name;
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.