X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FForm.php;h=6d59fd537f61a5baeb38737d22faecabf078c84e;hb=ad761ffeb995231339bdb775980618122cd09f39;hp=8ab1c22a0815003ec58b8fdd462d6d48fcbddcb6;hpb=ac90ec604a4248a909debb32bbf95fabbab6f377;p=civicrm-core.git diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 8ab1c22a08..6d59fd537f 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -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. * @@ -1574,7 +1586,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * Adds a select based on field metadata. * TODO: This could be even more generic and widget type (select in this case) could also be read from metadata * Perhaps a method like $form->bind($name) which would look up all metadata for named field - * @param $name + * @param string $name * Field name to go on the form. * @param array $props * Mix of html attributes and special properties, namely.