You are here

public function UpdateForm::update in Workspace 8

Callback handler for the update form button.

Parameters

array $form: The form array.

\Drupal\Core\Form\FormStateInterface $form_state: The form state data.

Return value

\Drupal\Core\Ajax\AjaxResponse The AJAX response.

File

src/Form/UpdateForm.php, line 230

Class

UpdateForm
The form to update the current workspace with its upstream.

Namespace

Drupal\workspace\Form

Code

public function update(array $form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $response
    ->addCommand(new CloseModalDialogCommand());
  if (\Drupal::moduleHandler()
    ->moduleExists('deploy')) {
    $response
      ->addCommand(new RedirectCommand(Url::fromRoute('entity.replication.collection')
      ->setAbsolute()
      ->toString()));
  }
  else {
    $status_messages = [
      '#type' => 'status_messages',
    ];
    $response
      ->addCommand(new PrependCommand('.region-highlighted', $this->renderer
      ->renderRoot($status_messages)));
  }
  return $response;
}