Browse Source

Add support to override the default button on Tripal importers.

Lacey Sanderson 5 years ago
parent
commit
a81d159354
2 changed files with 14 additions and 5 deletions
  1. 7 0
      tripal/includes/TripalImporter.inc
  2. 7 5
      tripal/includes/tripal.importer.inc

+ 7 - 0
tripal/includes/TripalImporter.inc

@@ -69,6 +69,13 @@ class TripalImporter {
    */
    */
   public static $button_text = 'Import File';
   public static $button_text = 'Import File';
 
 
+  /**
+   * If the loader should provide a submit button using $button_text above.
+   * Set this to FALSE to exclude the default button. This is useful for
+   * multi-page forms which need to change the button text.
+   */
+  public static $use_button;
+
   /**
   /**
    * Indicates the methods that the file uploader will support.
    * Indicates the methods that the file uploader will support.
    */
    */

+ 7 - 5
tripal/includes/tripal.importer.inc

@@ -111,11 +111,13 @@ function tripal_get_importer_form($form, &$form_state, $class) {
   // to change the order of their elements in reference to the default ones.
   // to change the order of their elements in reference to the default ones.
   $form = array_merge($form, $element_form);
   $form = array_merge($form, $element_form);
 
 
-  $form['button'] = [
-    '#type' => 'submit',
-    '#value' => t($class::$button_text),
-    '#weight' => 10,
-  ];
+  if (array_key_exists('use_button', $class::$methods) and $class::$methods['use_button'] == TRUE) {
+    $form['button'] = [
+      '#type' => 'submit',
+      '#value' => t($class::$button_text),
+      '#weight' => 10,
+    ];
+  }
   return $form;
   return $form;
 }
 }