You are here

public function IndexProcessorsForm::validateForm in Search API 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

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

Overrides FormBase::validateForm

File

src/Form/IndexProcessorsForm.php, line 274

Class

IndexProcessorsForm
Provides a form for configuring the processors of a search index.

Namespace

Drupal\search_api\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  $values = $form_state
    ->getValues();
  $processors = $this
    ->getAllProcessors();

  // Iterate over all processors that have a form and are enabled.
  foreach (array_keys(array_filter($values['status'])) as $processor_id) {
    $processor = $processors[$processor_id];
    if ($processor instanceof PluginFormInterface) {
      $processor_form_state = SubformState::createForSubform($form['settings'][$processor_id], $form, $form_state);
      $processor
        ->validateConfigurationForm($form['settings'][$processor_id], $processor_form_state);
    }
  }
}