You are here

function feeds_ui_create_form_submit in Feeds 8.2

Same name and namespace in other branches
  1. 6 feeds_ui/feeds_ui.admin.inc \feeds_ui_create_form_submit()
  2. 7.2 feeds_ui/feeds_ui.admin.inc \feeds_ui_create_form_submit()
  3. 7 feeds_ui/feeds_ui.admin.inc \feeds_ui_create_form_submit()

Submit handler for feeds_build_create_form().

File

feeds_ui/feeds_ui.admin.inc, line 187
Contains all page callbacks, forms and theming functions for Feeds administrative pages.

Code

function feeds_ui_create_form_submit($form, &$form_state) {

  // Create feed.
  $importer = feeds_importer($form_state['values']['id']);

  // If from_importer is given, copy its configuration.
  if (!empty($form['#from_importer'])) {
    $importer
      ->copy($form['#from_importer']);
  }

  // In any case, we want to set this configuration's title and description.
  $importer
    ->addConfig($form_state['values']);
  $importer
    ->save();

  // Set a message and redirect to settings form.
  if (empty($form['#from_importer'])) {
    drupal_set_message(t('Your configuration has been created with default settings. If they do not fit your use case you can adjust them here.'));
  }
  else {
    drupal_set_message(t('A clone of the @name configuration has been created.', array(
      '@name' => $form['#from_importer']->config['name'],
    )));
  }
  $form_state['redirect'] = 'admin/structure/feeds/' . $importer->id;
  feeds_cache_clear();
}