You are here

public function SearchApiTokenizer::configurationFormValidate in Search API 7

Validation callback for the form returned by configurationForm().

Parameters

array $form: The form returned by configurationForm().

array $values: The part of the $form_state['values'] array corresponding to this form.

array $form_state: The complete form state.

Overrides SearchApiAbstractProcessor::configurationFormValidate

File

includes/processor_tokenizer.inc, line 63
Contains SearchApiTokenizer.

Class

SearchApiTokenizer
Processor for tokenizing fulltext data by replacing (configurable) non-letters with spaces.

Code

public function configurationFormValidate(array $form, array &$values, array &$form_state) {
  parent::configurationFormValidate($form, $values, $form_state);
  $spaces = str_replace('/', '\\/', $values['spaces']);
  $ignorable = str_replace('/', '\\/', $values['ignorable']);
  if (@preg_match('/(' . $spaces . ')+/u', '') === FALSE) {
    $el = $form['spaces'];
    form_error($el, $el['#title'] . ': ' . t('The entered text is no valid regular expression.'));
  }
  if (@preg_match('/(' . $ignorable . ')+/u', '') === FALSE) {
    $el = $form['ignorable'];
    form_error($el, $el['#title'] . ': ' . t('The entered text is no valid regular expression.'));
  }
}