You are here

public function DateRecurModularSierraModalOccurrencesForm::ajaxShowMore in Recurring Date Field Modular Widgets 8

Same name and namespace in other branches
  1. 3.x src/Form/DateRecurModularSierraModalOccurrencesForm.php \Drupal\date_recur_modular\Form\DateRecurModularSierraModalOccurrencesForm::ajaxShowMore()
  2. 2.x src/Form/DateRecurModularSierraModalOccurrencesForm.php \Drupal\date_recur_modular\Form\DateRecurModularSierraModalOccurrencesForm::ajaxShowMore()

Callback to reload modal with more occurrences.

File

src/Form/DateRecurModularSierraModalOccurrencesForm.php, line 333

Class

DateRecurModularSierraModalOccurrencesForm
Generate a form to excluding occurrences, designed for display in modal.

Namespace

Drupal\date_recur_modular\Form

Code

public function ajaxShowMore(array &$form, FormStateInterface $form_state) : AjaxResponse {
  $form_state
    ->setRebuild();
  $multiplier = $form_state
    ->get('occurrence_multiplier');
  $form_state
    ->set('occurrence_multiplier', $multiplier + 1);
  $response = new AjaxResponse();
  $form = \Drupal::formBuilder()
    ->rebuildForm($this
    ->getFormId(), $form_state, $form);
  $response
    ->addCommand(new OpenModalDialogCommand($this
    ->t('Occurrences'), $form, [
    'width' => '575',
  ]));
  return $response;
}