Browse Source

Fixed bug in importers with form alter callback not properly altering importer form

Stephen Ficklin 11 years ago
parent
commit
83fbe8401a

+ 4 - 3
tripal_pub/includes/importers/AGL.inc

@@ -2,7 +2,8 @@
 /**
  *
  */
-function tripal_pub_remote_alter_form_AGL(&$form, $form_state) {
+function tripal_pub_remote_alter_form_AGL($form, $form_state) {
+
   $num_criteria = $form['num_criteria']['#default_value'];
 
   // So far we haven't been able to get AGL to filter results to only
@@ -15,7 +16,7 @@ function tripal_pub_remote_alter_form_AGL(&$form, $form_state) {
   for($i = 1; $i <= $num_criteria; $i++) {
     unset($form['criteria'][$i]["scope-$i"]['#options']['journal']);
   }
-
+  return $form;
 }
 /**
  *
@@ -872,4 +873,4 @@ function tripal_pub_remote_search_AGL_get_author($xml, $ind1) {
     }
   }
   return $author;
-}
+}

+ 4 - 2
tripal_pub/includes/importers/PMID.inc

@@ -9,7 +9,7 @@
 /**
  *
  */
-function tripal_pub_remote_alter_form_PMID(&$form, $form_state) {
+function tripal_pub_remote_alter_form_PMID($form, $form_state) {
   $num_criteria = $form['num_criteria']['#default_value'];
 
   // PubMed doesn't have an 'Abstract' field, so we need to convert the criteria
@@ -17,6 +17,8 @@ function tripal_pub_remote_alter_form_PMID(&$form, $form_state) {
   for($i = 1; $i <= $num_criteria; $i++) {
     $form['criteria'][$i]["scope-$i"]['#options']['abstract'] = 'Abstract/Title';
   }
+
+  return $form;
 }
 /**
  *
@@ -896,4 +898,4 @@ function tripal_pub_remote_search_get_language($lang_abbr) {
     'wel' => 'Welsh',
   );
   return $languages[strtolower($lang_abbr)];
-}
+}

+ 2 - 2
tripal_pub/includes/pub_importers.inc

@@ -431,7 +431,7 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
 
     // allow the selected remote database to make changes to the form if needed
     $callback = "tripal_pub_remote_alter_form_$remote_db";
-    call_user_func($callback, $form, $form_state);
+    $form = call_user_func($callback, $form, $form_state);
 
     return $form;
 }
@@ -623,4 +623,4 @@ function tripal_pub_importer_setup_page_update_criteria($action, $i) {
       'settings' => $settings,
   )
   );
-}
+}