You are here

public function EditRepeatingRuleModalForm::ajaxSubmit in Booking and Availability Management Tools for Drupal 8

File

modules/bat_event_series/src/Form/EditRepeatingRuleModalForm.php, line 223
Contains \Drupal\bat_event_series\Form\EditRepeatingRuleModalForm.

Class

EditRepeatingRuleModalForm

Namespace

Drupal\bat_event_series\Form

Code

public function ajaxSubmit(array &$form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $messages = [
    '#type' => 'status_messages',
  ];
  $response
    ->addCommand(new HtmlCommand('.form-validation-errors', $messages));
  if (!$form_state
    ->getErrors()) {
    $response
      ->addCommand(new CloseModalDialogCommand());
    $modal_form = $this->formBuilder
      ->getForm('Drupal\\bat_event_series\\Form\\EditRepeatingRuleConfirmationModalForm', $this->event_series);
    $modal_form['#attached']['library'][] = 'core/drupal.dialog.ajax';
    $response
      ->addCommand(new OpenModalDialogCommand($this
      ->t('Edit repeating rule'), $modal_form, [
      'width' => 600,
    ]));
  }
  return $response;
}