Custom feeds tamper plugin

feeds tamper module can map multiple columns inside a CSV to the same field as multiple value
But there is a constraint, each field can only "rewrite" once
For example, convert
abc.jpg
to
sites/default/files/abc.jpg
and then multiple them into
sites/default/files/abc.jpg,sites/default/files/def.jpg
Two rewrite is needed in this case
There is no solution from feeds tamper module, you can only use a full path inside the CSV to skip the first rewrtie

But actually write your own custom plugin for feeds tamper is not that difficult
convert
abc.jpg,def.jpg
to
sites/default/files/abc.jpg,sites/default/files/def.jpg
just need a prefix-er

As feeds tamper use the plugin system from ctools
it is easy to extend, and add custom plugin:

<?php
// prefix_feeds_tamper_plugin.module
function prefix_feeds_tamper_plugin_ctools_plugin_directory($owner, $plugin_type) {
  if (
$owner == 'feeds_tamper' && $plugin_type == 'plugins') {
    return
'plugins/';
  }
}
?>

to notice feeds tamper there is a custom plugin here

implementation:

<?php
// plugins/list_prefix.inc

// plugin info, you can copy from feeds tamper module's plugins
$plugin = array(
 
'form' => 'prefix_feeds_tamper_plugin_list_prefix_form',
 
'callback' => 'prefix_feeds_tamper_plugin_list_prefix_callback',
 
'name' => 'prefix',
 
'multi' => 'direct',
 
'single' => 'skip',
 
'category' => 'List',
);

// form API being used, also copying from feeds tamper
function prefix_feeds_tamper_plugin_list_prefix_form($importer, $element_key, $settings) {
 
$form = array();
 
$form['prefix'] = array(
   
'#type' => 'textfield',
   
'#title' => t('Prefix'),
   
'#default_value' => isset($settings['prefix']) ? $settings['prefix'] : '',
   
'#description' => t('The string to use for prefix.'),
  );
  return
$form;
}

// this is the real logic, notice that $fields can be String or an Array, depends on the definition of this plugin
function prefix_feeds_tamper_plugin_list_prefix_callback($result, $item_key, $element_key, &$field, $settings) {
 
$out = array();
  foreach (
$field as $f) {
   
$out[] = $settings['prefix'].$f;
  }
 
$field = $out;
}
?>

p.s. feeds_tamper-7.x-1.0-beta4

Google