You are here

public function EntityReferenceFilterViewResult::validateExposed in Views Reference Filter 8

Validate the exposed handler form

Overrides HandlerBase::validateExposed

File

src/Plugin/views/filter/EntityReferenceFilterViewResult.php, line 592

Class

EntityReferenceFilterViewResult
Filter by entity id using items got from the another view..

Namespace

Drupal\entityreference_filter\Plugin\views\filter

Code

public function validateExposed(&$form, FormStateInterface $form_state) {
  $exposed = $this
    ->isExposed();
  $identifier = $this->options['expose']['identifier'];
  if (!$exposed || !$identifier) {
    return;
  }

  // Except autocomplete widget.
  // We only validate if they've chosen the text field style.
  if ($this->options['type'] !== 'textfield') {
    if ($form_state
      ->getValue($identifier) !== 'All') {
      $this->validatedExposedInput = (array) $form_state
        ->getValue($identifier);
    }
    return;
  }

  // Autocomplete widget.
  // @todo autocomplete widget support
}