You are here

public function Toolbar::preRenderWorkspaceSwitcherForms in Workspace 8

Prerender callback; Adds the workspace switcher forms to the render array.

Parameters

array $element:

Return value

array The modified $element.

File

src/Toolbar.php, line 208

Class

Toolbar
Service for hooks and utilities related to Toolbar integration.

Namespace

Drupal\workspace

Code

public function preRenderWorkspaceSwitcherForms(array $element) {
  foreach ($this
    ->allWorkspaces() as $workspace) {
    $element['workspace_forms']['workspace_' . $workspace
      ->getMachineName()] = $this->formBuilder
      ->getForm(WorkspaceSwitcherForm::class, $workspace);
  }
  return $element;
}