You are here

public function DefaultEntityProcessorForm::validateConfigurationForm in Feeds 8.3

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 form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides ExternalPluginFormBase::validateConfigurationForm

File

src/Feeds/Processor/Form/DefaultEntityProcessorForm.php, line 199

Class

DefaultEntityProcessorForm
The configuration form for the CSV parser.

Namespace

Drupal\feeds\Feeds\Processor\Form

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->setValue('owner_id', (int) $form_state
    ->getValue('owner_id', 0));

  // Check if the selected option for 'update_non_existent' is still
  // available.
  $options = $this
    ->getUpdateNonExistentActions();
  $selected = $form_state
    ->getValue('update_non_existent');
  if (!isset($options[$selected])) {
    $form_state
      ->setError($form['update_non_existent'], $this
      ->t('The option %label is no longer available. Please select a different option.', [
      '%label' => $selected,
    ]));
  }
}