From fbedb3fb988e1141922a3eb729b4328a9e7acc8d Mon Sep 17 00:00:00 2001 From: Chris Leppanen <chris.leppanen@gmail.com> Date: Fri, 19 Apr 2013 02:31:56 -0700 Subject: [PATCH] Allow 0 as a term name. --- mappers/taxonomy.inc | 4 +++- plugins/FeedsTermProcessor.inc | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mappers/taxonomy.inc b/mappers/taxonomy.inc index 72cd3f13..02ac54e7 100644 --- a/mappers/taxonomy.inc +++ b/mappers/taxonomy.inc @@ -78,7 +78,9 @@ function taxonomy_feeds_processor_targets_alter(&$targets, $entity_type, $bundle * @todo Do not create new terms for non-autotag fields. */ function taxonomy_feeds_set_target($source, $entity, $target, $terms, $mapping = array()) { - if (empty($terms)) { + + // Allow mapping the string '0' to a term name. + if (empty($terms) && $terms != 0) { return; } diff --git a/plugins/FeedsTermProcessor.inc b/plugins/FeedsTermProcessor.inc index efbac620..b336096b 100644 --- a/plugins/FeedsTermProcessor.inc +++ b/plugins/FeedsTermProcessor.inc @@ -42,7 +42,7 @@ class FeedsTermProcessor extends FeedsProcessor { * Validates a term. */ protected function entityValidate($term) { - if (empty($term->name)) { + if (drupal_strlen($term->name) == 0) { throw new FeedsValidationException(t('Term name missing.')); } } -- GitLab