Browse Source

Merge branch '7.x-3.x' into 1040-tv3-gff3_performance

Stephen Ficklin 4 years ago
parent
commit
ff1916a59f
2 changed files with 17 additions and 6 deletions
  1. 8 0
      tripal/includes/TripalImporter.inc
  2. 9 6
      tripal/includes/tripal.importer.inc

+ 8 - 0
tripal/includes/TripalImporter.inc

@@ -57,6 +57,7 @@ class TripalImporter {
    */
   public static $use_analysis = TRUE;
 
+
   /**
    * If the $use_analysis value is set above then this value indicates if the
    * analysis should be required.
@@ -69,6 +70,13 @@ class TripalImporter {
    */
   public static $button_text = 'Import File';
 
+  /**
+   * If the form submit button that is provided by the Importer is not
+   * needed (i.e. the child class wants to do something different). Then
+   * set this to FALSE.
+   */
+  public static $use_button = TRUE;
+
   /**
    * Indicates the methods that the file uploader will support.
    */

+ 9 - 6
tripal/includes/tripal.importer.inc

@@ -103,7 +103,7 @@ function tripal_get_importer_form($form, &$form_state, $class) {
   $element_form = $importer->form($element, $form_state);
   // Quick check to make sure we had an array returned so array_merge() works.
   if (!is_array($element_form)) {
-    $element_form = arry();
+    $element_form = array();
   }
 
   // Merge the custom form with our default one.
@@ -111,11 +111,14 @@ function tripal_get_importer_form($form, &$form_state, $class) {
   // to change the order of their elements in reference to the default ones.
   $form = array_merge($form, $element_form);
 
-  $form['button'] = [
-    '#type' => 'submit',
-    '#value' => t($class::$button_text),
-    '#weight' => 10,
-  ];
+  if ($class::$use_button == TRUE) {
+    $form['button'] = [
+      '#type' => 'submit',
+      '#value' => t($class::$button_text),
+      '#weight' => 10,
+    ];
+  }
+
   return $form;
 }