You are here

public function OverridesSectionStorage::buildLocalTasks in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::buildLocalTasks()
  2. 9 core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::buildLocalTasks()

File

core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php, line 244

Class

OverridesSectionStorage
Defines the 'overrides' section storage type.

Namespace

Drupal\layout_builder\Plugin\SectionStorage

Code

public function buildLocalTasks($base_plugin_definition) {
  $local_tasks = [];
  foreach ($this
    ->getEntityTypes() as $entity_type_id => $entity_type) {
    $local_tasks["layout_builder.overrides.{$entity_type_id}.view"] = $base_plugin_definition + [
      'route_name' => "layout_builder.overrides.{$entity_type_id}.view",
      'weight' => 15,
      'title' => $this
        ->t('Layout'),
      'base_route' => "entity.{$entity_type_id}.canonical",
      'cache_contexts' => [
        'layout_builder_is_active:' . $entity_type_id,
      ],
    ];
  }
  return $local_tasks;
}