private function clearForm(array $values, FormStateInterface &$form_state) {
    $input = $form_state->getUserInput();

    foreach ($values as $value) {
      if ($form_state->hasValue($value)) {
        $form_state->unsetValue($value);
      }

      if (isset($input[$value])) {
        unset($input[$value]);
      }
    }

    $form_state->setUserInput($input);
  }
private function clearForm(array $values, FormStateInterface &$form_state) {
    $input = $form_state->getUserInput();

    foreach ($values as $value) {
      if ($form_state->hasValue($value)) {
        $form_state->unsetValue($value);
      }

      if (isset($input[$value])) {
        unset($input[$value]);
      }
    }

    $form_state->setUserInput($input);
  }
private function clearForm ( array $ values , FormStateInterface & $ form_state ) { $ input = $ form_state -> getUserInput ( ) ; foreach ( $ values as $ value ) { if ( $ form_state -> hasValue ( $ value ) ) { $ form_state -> unsetValue ( $ value ) ; } if ( isset ( $ input [ $ value ] ) ) { unset ( $ input [ $ value ] ) ; } } $ form_state -> setUserInput ( $ input ) ; }
Clear previously selected form values.

@param array $values
A list of values to clear.
@param \Drupal\Core\Form\FormStateInterface $form_state
Form state.
Clear previously selected form values .