diff --git a/mappers/taxonomy.inc b/mappers/taxonomy.inc index 8925ad2..a1d5fe6 100644 --- a/mappers/taxonomy.inc +++ b/mappers/taxonomy.inc @@ -68,6 +68,7 @@ function taxonomy_feeds_processor_targets($entity_type, $bundle_name) { 'description' => t('The @label field of the entity.', array('@label' => $instance['label'])), 'summary_callback' => array('taxonomy_feeds_summary_callback'), 'form_callback' => array('taxonomy_feeds_form_callback'), + 'preprocess_callback' => array('taxonomy_feeds_preprocess_callback'), ); } } @@ -80,17 +81,22 @@ function taxonomy_feeds_processor_targets($entity_type, $bundle_name) { } /** - * Callback for mapping. Here is where the actual mapping happens. - * - * @todo Do not create new terms for non-autotag fields. + * Callback for processing the mapping array. */ -function taxonomy_feeds_set_target($source, $entity, $target, array $terms, $mapping = array()) { +function taxonomy_feeds_preprocess_callback(FeedsSource $source, $entity, $target, array $terms, array &$mapping) { // Add in default values. $mapping += array( 'term_search' => FEEDS_TAXONOMY_SEARCH_TERM_NAME, 'autocreate' => FALSE, ); +} +/** + * Callback for mapping. Here is where the actual mapping happens. + * + * @todo Do not create new terms for non-autotag fields. + */ +function taxonomy_feeds_set_target($source, $entity, $target, array $terms, $mapping = array()) { $info = field_info_field($target); $cache = &drupal_static(__FUNCTION__); diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc index 5b1bcbe..5dc3f36 100755 --- a/plugins/FeedsProcessor.inc +++ b/plugins/FeedsProcessor.inc @@ -669,6 +669,12 @@ abstract class FeedsProcessor extends FeedsPlugin { $value = array($value); } + if (!empty($mapping['preprocess_callback'])) { + foreach ($mapping['preprocess_callback'] as $preprocess) { + $preprocess($source, $target_item, $mapping['target'], $value, $mapping); + } + } + $callback($source, $target_item, $mapping['target'], $value, $mapping); } else {