function WorkspaceSwitcherBlock::build
Same name in other branches
- 9 core/modules/workspaces/src/Plugin/Block/WorkspaceSwitcherBlock.php \Drupal\workspaces\Plugin\Block\WorkspaceSwitcherBlock::build()
- 8.9.x core/modules/workspaces/src/Plugin/Block/WorkspaceSwitcherBlock.php \Drupal\workspaces\Plugin\Block\WorkspaceSwitcherBlock::build()
- 11.x core/modules/workspaces/src/Plugin/Block/WorkspaceSwitcherBlock.php \Drupal\workspaces\Plugin\Block\WorkspaceSwitcherBlock::build()
Overrides BlockPluginInterface::build
File
-
core/
modules/ workspaces/ src/ Plugin/ Block/ WorkspaceSwitcherBlock.php, line 77
Class
- WorkspaceSwitcherBlock
- Provides a 'Workspace switcher' block.
Namespace
Drupal\workspaces\Plugin\BlockCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.