public function WorkspaceActivateFormBase::submitForm in Workspace 8
@inheritDoc
Overrides FormInterface::submitForm
File
- src/
Form/ WorkspaceActivateFormBase.php, line 67
Class
- WorkspaceActivateFormBase
- The base class for forms that activate a workspace.
Namespace
Drupal\workspace\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$id = $form_state
->getValue('workspace_id');
/** @var WorkspaceInterface $workspace */
$workspace = $this->entityTypeManager
->getStorage('workspace')
->load($id);
try {
$this->workspaceManager
->setActiveWorkspace($workspace);
$form_state
->setRedirect('<front>');
} catch (\Exception $e) {
watchdog_exception('Workspace', $e);
drupal_set_message($e
->getMessage(), 'error');
}
}