You are here

public function AbjsTestForm::abjsAjaxRemoveExperience in A/B Test JS 8

Same name and namespace in other branches
  1. 2.0.x src/Form/AbjsTestForm.php \Drupal\abjs\Form\AbjsTestForm::abjsAjaxRemoveExperience()

Removes experience select fields and fractions to AbjsTestForm.

File

src/Form/AbjsTestForm.php, line 369

Class

AbjsTestForm
Class for build form test.

Namespace

Drupal\abjs\Form

Code

public function abjsAjaxRemoveExperience(array $form, FormStateInterface $form_state) {
  if ($form_state
    ->get('num_experiences') > 1) {
    $form_state
      ->set('num_experiences', $form_state
      ->get('num_experiences') - 1);
  }
  $form_state
    ->setRebuild();
}