X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Flayout_builder%2Fsrc%2FPlugin%2FSectionStorage%2FDefaultsSectionStorage.php;fp=web%2Fcore%2Fmodules%2Flayout_builder%2Fsrc%2FPlugin%2FSectionStorage%2FDefaultsSectionStorage.php;h=d35041d03d8fe09835e442cf85cd3b538b2d5c20;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=6fab11996b02d3de386112ad6268370ea5cd6167;hpb=9424afc6c1f518c301bf87a23c047d1873435d05;p=yaffs-website diff --git a/web/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php b/web/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php index 6fab11996..d35041d03 100644 --- a/web/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php +++ b/web/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php @@ -32,7 +32,7 @@ use Symfony\Component\Routing\RouteCollection; * experimental modules and development releases of contributed modules. * See https://www.drupal.org/core/experimental for more information. */ -class DefaultsSectionStorage extends SectionStorageBase implements ContainerFactoryPluginInterface, DefaultsSectionStorageInterface { +class DefaultsSectionStorage extends SectionStorageBase implements ContainerFactoryPluginInterface, DefaultsSectionStorageInterface, SectionStorageLocalTaskProviderInterface { /** * The entity type manager. @@ -196,6 +196,32 @@ class DefaultsSectionStorage extends SectionStorageBase implements ContainerFact } } + /** + * {@inheritdoc} + */ + public function buildLocalTasks($base_plugin_definition) { + $local_tasks = []; + foreach ($this->getEntityTypes() as $entity_type_id => $entity_type) { + $local_tasks["layout_builder.defaults.$entity_type_id.view"] = $base_plugin_definition + [ + 'route_name' => "layout_builder.defaults.$entity_type_id.view", + 'title' => $this->t('Manage layout'), + 'base_route' => "layout_builder.defaults.$entity_type_id.view", + ]; + $local_tasks["layout_builder.defaults.$entity_type_id.save"] = $base_plugin_definition + [ + 'route_name' => "layout_builder.defaults.$entity_type_id.save", + 'title' => $this->t('Save Layout'), + 'parent_id' => "layout_builder_ui:layout_builder.defaults.$entity_type_id.view", + ]; + $local_tasks["layout_builder.defaults.$entity_type_id.cancel"] = $base_plugin_definition + [ + 'route_name' => "layout_builder.defaults.$entity_type_id.cancel", + 'title' => $this->t('Cancel Layout'), + 'weight' => 5, + 'parent_id' => "layout_builder_ui:layout_builder.defaults.$entity_type_id.view", + ]; + } + return $local_tasks; + } + /** * Returns an array of relevant entity types. *