You are here

function file_feeds_form_callback in Feeds 7.2

Mapping configuration form callback for file targets.

1 string reference to 'file_feeds_form_callback'
file_feeds_processor_targets in mappers/file.inc
Implements hook_feeds_processor_targets().

File

mappers/file.inc, line 230
On behalf implementation of Feeds mapping API for file.module and image.module.

Code

function file_feeds_form_callback($mapping, $target, $form, $form_state) {
  $description = array(
    '#theme' => 'item_list',
    '#items' => array(
      t('Rename: files whose name is already in use are renamed.'),
      t('Replace: files on the site with the same name are replaced.'),
      t('Replace only if different: files on the site with the same name are replaced only if the file to import is different, in other cases the file will not be imported. Works only if the file to import is locally accessible.'),
      t('Rename only if different: files on the site with the same name are renamed only if the file to import is different, in other cases the file will not be imported. Works only if the file to import is locally accessible.'),
      t('Skip existing: files whose name is already in use are not imported.'),
    ),
  );
  return array(
    'file_exists' => array(
      '#type' => 'select',
      '#title' => t('Replacement method'),
      '#default_value' => !empty($mapping['file_exists']) ? $mapping['file_exists'] : FILE_EXISTS_RENAME,
      '#options' => array(
        FILE_EXISTS_RENAME => t('Rename'),
        FILE_EXISTS_REPLACE => t('Replace'),
        FEEDS_FILE_EXISTS_REPLACE_DIFFERENT => t('Replace only if different'),
        FEEDS_FILE_EXISTS_RENAME_DIFFERENT => t('Rename only if different'),
        FEEDS_FILE_EXISTS_SKIP => t('Skip existing'),
      ),
      '#description' => t('New files are always copied. Files that have a name that is already in use on the site are handled based on this setting.') . drupal_render($description) . t('Note that this setting has no effect when using the File (Field) Paths module.'),
    ),
  );
}