public function WorkspaceDeployForm::deploy in Drupal 8
Form submission handler; deploys the content to the workspace's target.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- core/
modules/ workspaces/ src/ Form/ WorkspaceDeployForm.php, line 150
Class
- WorkspaceDeployForm
- Provides the workspace deploy form.
Namespace
Drupal\workspaces\FormCode
public function deploy(array &$form, FormStateInterface $form_state) {
$workspace = $this->entity;
try {
$workspace
->publish();
$this->messenger
->addMessage($this
->t('Successful deployment.'));
} catch (WorkspaceAccessException $e) {
$this->messenger
->addMessage($e
->getMessage(), 'error');
} catch (\Exception $e) {
$this->messenger
->addMessage($this
->t('Deployment failed. All errors have been logged.'), 'error');
}
}