summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Barth2010-10-28 18:49:47 (GMT)
committer Alex Barth2010-10-28 18:49:47 (GMT)
commit488ecf60cdc29b28ea94c1f1cd2387674b9bef6b (patch)
tree8eec0aba6d71e441f066209e6b2dae789e8b8c60
parent14e794842e5024581ca6fe8ee0e7e97fd7437187 (diff)
Minor cleanups, remove unused code, improve comments, denote helper functions as private.
-rw-r--r--mappers/field.inc29
1 files changed, 19 insertions, 10 deletions
diff --git a/mappers/field.inc b/mappers/field.inc
index e2910b1..c979cb8 100644
--- a/mappers/field.inc
+++ b/mappers/field.inc
@@ -62,33 +62,42 @@ function field_feeds_set_target_numeric($source, $entity, $target, $value) {
unset($value[$k]);
}
}
- field_feeds_set_target($source, $entity, $target, $value, FALSE);
+ _field_feeds_set_target($source, $entity, $target, $value, FALSE);
}
+/**
+ * Callback for mapping text fields.
+ */
function field_feeds_set_target_text($source, $entity, $target, $value) {
if (!is_array($value)) {
$value = array($value);
}
- field_feeds_set_target($source, $entity, $target, $value, TRUE);
+ _field_feeds_set_target($source, $entity, $target, $value, TRUE);
}
/**
- * Callback for mapping. Here is where the actual mapping happens.
+ * Helper for mapping.
*
* When the callback is invoked, $target contains the name of the field the
* user has decided to map to and $value contains the value of the feed item
* element the user has picked as a source.
+ *
+ * @param $source
+ * A FeedsSource object.
+ * @param $entity
+ * The entity to map to.
+ * @param $target
+ * The target key on $entity to map to.
+ * @param $value
+ * The value to map. MUST be an array.
+ * @param $input_format
+ * TRUE if an input format should be applied.
*/
-function field_feeds_set_target($source, $entity, $target, $value, $input_format = FALSE) {
- // @param $value must be an array, and not empty.
+function _field_feeds_set_target($source, $entity, $target, $value, $input_format = FALSE) {
if (empty($value)) {
return;
}
- // Handle non-multiple value fields.
- if (!is_array($value)) {
- $value = array($value);
- }
-
+
if ($input_format) {
if (isset($source->importer->processor->config['input_format'])) {
$format = $source->importer->processor->config['input_format'];