function WorkspacePublishForm::submitForm
Same name in other branches
- 9 core/modules/workspaces/src/Form/WorkspacePublishForm.php \Drupal\workspaces\Form\WorkspacePublishForm::submitForm()
- 10 core/modules/workspaces/src/Form/WorkspacePublishForm.php \Drupal\workspaces\Form\WorkspacePublishForm::submitForm()
Overrides FormInterface::submitForm
File
-
core/
modules/ workspaces/ src/ Form/ WorkspacePublishForm.php, line 145
Class
- WorkspacePublishForm
- Provides the workspace publishing form.
Namespace
Drupal\workspaces\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$workspace = $this->workspace;
try {
$workspace->publish();
$this->messenger()
->addMessage($this->t('Successful publication.'));
} catch (WorkspaceAccessException $e) {
$this->messenger()
->addMessage($e->getMessage(), 'error');
} catch (\Exception $e) {
$this->messenger()
->addMessage($this->t('Publication failed. All errors have been logged.'), 'error');
$this->getLogger('workspaces')
->error($e->getMessage());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.