You are here

function views_handler_filter_search::exposed_validate in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 modules/search/views_handler_filter_search.inc \views_handler_filter_search::exposed_validate()
  2. 7.3 modules/search/views_handler_filter_search.inc \views_handler_filter_search::exposed_validate()

Validate the options form.

Overrides views_handler::exposed_validate

File

modules/search/views_handler_filter_search.inc, line 51

Class

views_handler_filter_search
Field handler to provide simple renderer that allows linking to a node.

Code

function exposed_validate($form, &$form_state) {
  if (!isset($this->options['expose']['identifier'])) {
    return;
  }
  $key = $this->options['expose']['identifier'];
  if (!empty($form_state['values'][$key])) {
    $this->search_query = search_parse_query($form_state['values'][$key]);
    if ($this->search_query[2] == '') {
      form_set_error($key, t('You must include at least one positive keyword with @count characters or more.', array(
        '@count' => variable_get('minimum_word_size', 3),
      )));
    }
    if ($this->search_query[6]) {
      if ($this->search_query[6] == 'or') {
        drupal_set_message(t('Search for either of the two terms with uppercase <strong>OR</strong>. For example, <strong>cats OR dogs</strong>.'));
      }
    }
  }
}