Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldUiLocalTask.php

function 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\Derivative

Code

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;
            }
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal