You are here

function feeds_ui_mapping_form_add_submit in Feeds 6

Same name and namespace in other branches
  1. 7 feeds_ui/feeds_ui.admin.inc \feeds_ui_mapping_form_add_submit()

Submit handler for add button on feeds_ui_mapping_form().

1 string reference to 'feeds_ui_mapping_form_add_submit'
feeds_ui_mapping_form in feeds_ui/feeds_ui.admin.inc
Edit mapping.

File

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

Code

function feeds_ui_mapping_form_add_submit($form, &$form_state) {
  $importer = $form['#importer'];
  try {
    $mappings = $form['#mappings'];
    $mappings[] = array(
      'source' => $form_state['values']['source'],
      'target' => $form_state['values']['target'],
      'unique' => FALSE,
    );
    $importer->processor
      ->addConfig(array(
      'mappings' => $mappings,
    ));
    $importer->processor
      ->save();
    drupal_set_message(t('Mapping has been added.'));
  } catch (Exception $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
  }
}