You are here

public function MappingForm::validateForm in Feeds 8.3

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/MappingForm.php, line 610

Class

MappingForm
Provides a form for mapping settings.

Namespace

Drupal\feeds\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (isset($form_state
    ->getTriggeringElement()['#delta'])) {
    $delta = $form_state
      ->getTriggeringElement()['#delta'];
    $this->feedType
      ->getTargetPlugin($delta)
      ->validateConfigurationForm($form, $form_state);
    $form_state
      ->setRebuild();
  }
  else {

    // Allow plugins to validate the mapping form.
    foreach ($this->feedType
      ->getPlugins() as $plugin) {
      if ($plugin instanceof MappingPluginFormInterface) {
        $plugin
          ->mappingFormValidate($form, $form_state);
      }
    }
  }
}