function WorkspaceActivateForm::submitForm
Same name in other branches
- 9 core/modules/workspaces/src/Form/WorkspaceActivateForm.php \Drupal\workspaces\Form\WorkspaceActivateForm::submitForm()
- 10 core/modules/workspaces/src/Form/WorkspaceActivateForm.php \Drupal\workspaces\Form\WorkspaceActivateForm::submitForm()
- 11.x core/modules/workspaces/src/Form/WorkspaceActivateForm.php \Drupal\workspaces\Form\WorkspaceActivateForm::submitForm()
Overrides EntityForm::submitForm
File
-
core/
modules/ workspaces/ src/ Form/ WorkspaceActivateForm.php, line 106
Class
- WorkspaceActivateForm
- Handle activation of a workspace on administrative pages.
Namespace
Drupal\workspaces\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
try {
$this->workspaceManager
->setActiveWorkspace($this->entity);
$this->messenger
->addMessage($this->t('%workspace_label is now the active workspace.', [
'%workspace_label' => $this->entity
->label(),
]));
} catch (WorkspaceAccessException $e) {
$this->messenger
->addError($this->t('You do not have access to activate the %workspace_label workspace.', [
'%workspace_label' => $this->entity
->label(),
]));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.