You are here

public function Stopwords::submitConfigurationForm in Search API 8

Form submission 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 PluginFormTrait::submitConfigurationForm

See also

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

File

src/Plugin/search_api/processor/Stopwords.php, line 93

Class

Stopwords
Allows you to define stopwords which will be ignored in searches.

Namespace

Drupal\search_api\Plugin\search_api\processor

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {

  // Convert our text input to an array.
  $stopwords = $form_state
    ->getValue('stopwords', '');
  $stopwords = explode("\n", $stopwords);
  $stopwords = array_map('trim', $stopwords);
  $stopwords = array_filter($stopwords, 'strlen');
  $form_state
    ->setValue('stopwords', $stopwords);
  parent::submitConfigurationForm($form, $form_state);
}