You are here

public function EditFeedForm::submitForm in Feed Import 8

Form submission 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 FormInterface::submitForm

File

src/Form/EditFeedForm.php, line 102

Class

EditFeedForm
Feed Importer edit form.

Namespace

Drupal\feed_import\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $v = $form_state
    ->getValues();
  $this->feed->name = $v['name'];
  $this->feed->entity = $v['entity'];
  $this->feed->cron_import = $v['cron_import'];
  $this->feed->settings['feed'] = $v['feed'];
  $this->feed->settings['preprocess'] = $v['preprocess'];
  if (FeedImport::saveFeed($this->feed)) {
    drupal_set_message(t('Feed saved'));
    $form_state
      ->setRedirect('feed_import.admin_edit', [
      'fid' => $this->feed->machine_name,
    ]);
  }
  else {
    drupal_set_message(t('Error saving feed'), 'error');
  }
}