Merge pull request #22948 from pradpnayak/fixfatalerror3
[civicrm-core.git] / CRM / Core / Form.php
index d3e8a94306b98b9d2d4678de16219a6bf3df01a6..6d59fd537f61a5baeb38737d22faecabf078c84e 100644 (file)
@@ -611,11 +611,11 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   /**
    * This virtual function is used to set the default values of various form elements.
    *
-   * @return array|NULL
+   * @return array
    *   reference to the array of default values
    */
   public function setDefaultValues() {
-    return NULL;
+    return [];
   }
 
   /**
@@ -719,7 +719,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     // our ensured variables get blown away, so we need to set them even if
     // it's already been initialized.
     self::$_template->ensureVariablesAreAssigned($this->expectedSmartyVariables);
-
+    self::$_template->addExpectedTabHeaderKeys();
   }
 
   /**
@@ -1113,6 +1113,18 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     $this->expectedSmartyVariables[] = $elementName;
   }
 
+  /**
+   * Add an expected smarty variable to the array.
+   *
+   * @param array $elementNames
+   */
+  public function addExpectedSmartyVariables(array $elementNames): void {
+    foreach ($elementNames as $elementName) {
+      // Duplicates don't actually matter....
+      $this->addExpectedSmartyVariable($elementName);
+    }
+  }
+
   /**
    * Render form and return contents.
    *