You are here

protected function Populate::valueValidate in Views filters populate 8

Validate the options form.

Overrides FilterPluginBase::valueValidate

File

src/Plugin/views/filter/Populate.php, line 138

Class

Populate
Filter handler which allows to search on multiple fields.

Namespace

Drupal\views_filters_populate\Plugin\views\filter

Code

protected function valueValidate($form, FormStateInterface $form_state) {
  $filters = $form_state
    ->getValue([
    'options',
    'filters',
  ]);
  if (empty($form['filters']['#options'])) {
    $form_state
      ->setErrorByName('options][filters', $this
      ->t('You have to add <b>supported non exposed</b> filters to be able to use this filter.'));
  }
  elseif (empty($filters)) {
    $form_state
      ->setErrorByName('options][filters', $this
      ->t('You have to select at least one filter to be populated.'));
  }
}