You are here

public function Stemmer::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/Stemmer.php, line 88

Class

Stemmer
Stems search terms.

Namespace

Drupal\search_api\Plugin\search_api\processor

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  $exceptions = $form_state
    ->getValue('exceptions');
  if (($parsed = parse_ini_string($exceptions)) === FALSE) {
    $el = $form['exceptions'];
    $form_state
      ->setError($el, $el['#title'] . ': ' . $this
      ->t('The entered text is not in valid WORD=STEM format.'));
  }
  else {
    $form_state
      ->setValue('exceptions', $parsed);
  }
}