function WorkspacePublishForm::submitForm
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
-
core/
modules/ workspaces/ src/ Form/ WorkspacePublishForm.php, line 143
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.