From 878f601ef27a6b6f1a76cc5ac9f0f7f2de6764bf Mon Sep 17 00:00:00 2001
From: Alex Barth <alex_b@53995.no-reply.drupal.org>
Date: Wed, 28 Oct 2009 01:02:54 +0000
Subject: [PATCH] Accomodate parsers without source definitions.

---
 feeds_ui/feeds_ui.admin.inc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/feeds_ui/feeds_ui.admin.inc b/feeds_ui/feeds_ui.admin.inc
index c2caa878..0486ca25 100644
--- a/feeds_ui/feeds_ui.admin.inc
+++ b/feeds_ui/feeds_ui.admin.inc
@@ -505,6 +505,9 @@ function feeds_ui_mapping_form(&$form_state, $importer) {
       $legend['sources'][$k]['description']['#value'] = (is_array($source) && !empty($source['description'])) ? $source['description'] : '';
     }
   }
+  else {
+    $legend['sources']['#value'] = t('This parser supports free source definitions. Enter the name of the source field in lower case into the Source text field above.');
+  }
   $targets = $importer->processor->getMappingTargets();
   $target_options = _feeds_ui_format_options($targets);
   foreach ($targets as $k => $target) {
@@ -795,6 +798,7 @@ function theme_feeds_ui_mapping_form($form) {
   $output .= theme('table', $header, $rows);
 
   // Build the help table that explains available sources.
+  $legend = '';
   $rows = array();
   foreach (element_children($form['legendset']['legend']['sources']) as $k) {
     $rows[] = array(
@@ -802,8 +806,10 @@ function theme_feeds_ui_mapping_form($form) {
       drupal_render($form['legendset']['legend']['sources'][$k]['description']),
     );
   }
-  $legend = '<h3>'. t('Sources') .'</h3>';
-  $legend .= theme('table', array(t('Name'), t('Description')), $rows);
+  if (count($rows)) {
+    $legend .= '<h3>'. t('Sources') .'</h3>';
+    $legend .= theme('table', array(t('Name'), t('Description')), $rows);
+  }
 
   // Build the help table that explains available targets.
   $rows = array();
-- 
GitLab