You are here

public function AbjsTestForm::abjsAjaxRemoveCondition 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::abjsAjaxRemoveCondition()

Removes condition select fields to AbjsTestForm.

File

src/Form/AbjsTestForm.php, line 344

Class

AbjsTestForm
Class for build form test.

Namespace

Drupal\abjs\Form

Code

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