Same name in other branches
  1. 8.x-3.x src/Form/QuickTabsInstanceEditForm.php \Drupal\quicktabs\Form\QuickTabsInstanceEditForm::ajaxFormSubmit()

Submit handler for the 'Add Tab' and 'Remove' buttons.

Removes a row or increments the number of rows depending on action.

File

src/Form/QuickTabsInstanceEditForm.php, line 249

Class

QuickTabsInstanceEditForm
Class QuickTabsInstanceEditForm.

Namespace

Drupal\quicktabs\Form

Code

public function ajaxFormSubmit(array &$form, FormStateInterface $form_state) {
    if ($form_state->getTriggeringElement()['#name'] === 'tabs_more') {
        $form_state->set('num_tabs', count($form_state->getValue('configuration_data')) + 1);
        $form_state->setRebuild(TRUE);
    }
    elseif (is_numeric($form_state->getTriggeringElement()['#row_number'])) {
        $form_state->set('to_remove', $form_state->getTriggeringElement()['#row_number']);
        $form_state->setRebuild(TRUE);
    }
}