You are here

public function Combine::validate in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/filter/Combine.php \Drupal\views\Plugin\views\filter\Combine::validate()

Validate that the plugin is correct and can be saved.

Return value

An array of error strings to tell the user what is wrong with this plugin.

Overrides HandlerBase::validate

File

core/modules/views/src/Plugin/views/filter/Combine.php, line 101
Contains \Drupal\views\Plugin\views\filter\Combine.

Class

Combine
Filter handler which allows to search on multiple fields.

Namespace

Drupal\views\Plugin\views\filter

Code

public function validate() {
  $errors = parent::validate();
  $fields = $this->view->display_handler
    ->getHandlers('field');
  foreach ($this->options['fields'] as $id) {
    if (!isset($fields[$id])) {

      // Combined field filter only works with fields that are in the field
      // settings.
      $errors[] = $this
        ->t('Field %field set in %filter is not set in this display.', array(
        '%field' => $id,
        '%filter' => $this
          ->adminLabel(),
      ));
      break;
    }
  }
  return $errors;
}