You are here

public function IgnoreCharacters::validateConfigurationForm in Search API 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the complete form.

Overrides FieldsProcessorPluginBase::validateConfigurationForm

See also

\Drupal\Core\Plugin\PluginFormInterface::validateConfigurationForm()

File

src/Plugin/search_api/processor/IgnoreCharacters.php, line 92

Class

IgnoreCharacters
Configure types of characters which should be ignored for searches.

Namespace

Drupal\search_api\Plugin\search_api\processor

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  $ignorable = str_replace('/', '\\/', $form_state
    ->getValue('ignorable', ''));
  if ($ignorable !== '' && @preg_match('/(' . $ignorable . ')+/u', '') === FALSE) {
    $el = $form['ignorable'];
    $form_state
      ->setError($el, $el['#title'] . ': ' . $this
      ->t('The entered text is no valid regular expression.'));
  }
}