You are here

function feeds_tamper_copy_form in Feeds Tamper 7

Same name and namespace in other branches
  1. 6 plugins/copy.inc \feeds_tamper_copy_form()
1 string reference to 'feeds_tamper_copy_form'
copy.inc in plugins/copy.inc

File

plugins/copy.inc, line 15

Code

function feeds_tamper_copy_form($importer, $element_key, $settings) {
  $form = $sources = array();
  $source_configs = $importer->parser
    ->getMappingSources();
  $normal = feeds_tamper_get_unique_source_list($importer, FALSE);
  $lower = feeds_tamper_get_unique_source_list($importer, TRUE);
  foreach (array_combine($normal, $lower) as $source => $mapsource) {
    if (isset($source_configs[$source]) && !empty($source_configs[$source]['name'])) {
      $sources[$mapsource] = $source_configs[$source]['name'];
    }
    else {
      $sources[$mapsource] = $source;
    }
  }
  $form['to_from'] = array(
    '#title' => t('To or from'),
    '#type' => 'radios',
    '#default_value' => isset($settings['to_from']) ? $settings['to_from'] : 'to',
    '#options' => array(
      'to' => t('To'),
      'from' => t('From'),
    ),
    '#description' => t('Select whether this source value should be copied <em>to</em> another source, or <em>from</em> another source to this one.'),
  );
  $form['source'] = array(
    '#type' => 'radios',
    '#default_value' => isset($settings['source']) ? $settings['source'] : key($sources),
    '#options' => $sources,
    '#title' => t('Source'),
  );
  return $form;
}