X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fworkspaces%2Fsrc%2FPlugin%2FBlock%2FWorkspaceSwitcherBlock.php;fp=web%2Fcore%2Fmodules%2Fworkspaces%2Fsrc%2FPlugin%2FBlock%2FWorkspaceSwitcherBlock.php;h=2f5a2fe743a3957153809df9f9845af75e107ec5;hp=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/workspaces/src/Plugin/Block/WorkspaceSwitcherBlock.php b/web/core/modules/workspaces/src/Plugin/Block/WorkspaceSwitcherBlock.php new file mode 100644 index 000000000..2f5a2fe74 --- /dev/null +++ b/web/core/modules/workspaces/src/Plugin/Block/WorkspaceSwitcherBlock.php @@ -0,0 +1,84 @@ +formBuilder = $form_builder; + $this->entityTypeManager = $entity_type_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('form_builder'), + $container->get('entity_type.manager') + ); + } + + /** + * {@inheritdoc} + */ + public function build() { + $build = [ + 'form' => $this->formBuilder->getForm(WorkspaceSwitcherForm::class), + '#cache' => [ + 'contexts' => $this->entityTypeManager->getDefinition('workspace')->getListCacheContexts(), + 'tags' => $this->entityTypeManager->getDefinition('workspace')->getListCacheTags(), + ], + ]; + return $build; + } + +}