public function SimpleConfigSectionStorage::buildLocalTasks in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php \Drupal\layout_builder_test\Plugin\SectionStorage\SimpleConfigSectionStorage::buildLocalTasks()
Provides the local tasks dynamically for Layout Builder plugins.
Parameters
mixed $base_plugin_definition: The definition of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative ID.
Overrides SectionStorageLocalTaskProviderInterface::buildLocalTasks
File
- core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ src/ Plugin/ SectionStorage/ SimpleConfigSectionStorage.php, line 152
Class
- SimpleConfigSectionStorage
- Provides section storage utilizing simple config.
Namespace
Drupal\layout_builder_test\Plugin\SectionStorageCode
public function buildLocalTasks($base_plugin_definition) {
$type = $this
->getStorageType();
$local_tasks = [];
$local_tasks["layout_builder.{$type}.view"] = $base_plugin_definition + [
'route_name' => "layout_builder.{$type}.view",
'title' => $this
->t('Layout'),
'base_route' => "layout_builder.{$type}.view",
];
$local_tasks["layout_builder.{$type}.view__child"] = $base_plugin_definition + [
'route_name' => "layout_builder.{$type}.view",
'title' => $this
->t('Layout'),
'parent_id' => "layout_builder_ui:layout_builder.{$type}.view",
];
$local_tasks["layout_builder.{$type}.discard_changes"] = $base_plugin_definition + [
'route_name' => "layout_builder.{$type}.discard_changes",
'title' => $this
->t('Discard changes'),
'parent_id' => "layout_builder_ui:layout_builder.{$type}.view",
'weight' => 5,
];
return $local_tasks;
}