X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FForm.php;h=a3c4023c0edb89e82936b4486cf82de9151d5042;hb=a06c30f5504159043382ad5fcb58340e2987d0a2;hp=1ab3ccc8764006c25b06e0260421eefc8fb5b8fd;hpb=14eff2f70f9768a47a11180d9d859a653fbcc199;p=civicrm-core.git diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 1ab3ccc876..a3c4023c0e 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -419,9 +419,9 @@ class CRM_Core_Form extends HTML_QuickForm_Page { unset($extra['option_context']); } - $element = $this->addElement($type, $name, $label, $attributes, $extra); + $element = $this->addElement($type, $name, CRM_Utils_String::purifyHTML($label), $attributes, $extra); if (HTML_QuickForm::isError($element)) { - CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element)); + CRM_Core_Error::statusBounce(HTML_QuickForm::errorMessage($element)); } if ($inputType == 'color') { @@ -436,7 +436,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $error = $this->addRule($name, ts('%1 is a required field.', [1 => $label]), 'required'); } if (HTML_QuickForm::isError($error)) { - CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element)); + CRM_Core_Error::statusBounce(HTML_QuickForm::errorMessage($element)); } } @@ -2015,7 +2015,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { public function addEntityRef($name, $label = '', $props = [], $required = FALSE) { // Default properties $props['api'] = CRM_Utils_Array::value('api', $props, []); - $props['entity'] = CRM_Utils_String::convertStringToCamel(CRM_Utils_Array::value('entity', $props, 'Contact')); + $props['entity'] = CRM_Core_DAO_AllCoreTables::convertEntityNameToCamel(CRM_Utils_Array::value('entity', $props, 'Contact')); $props['class'] = ltrim(CRM_Utils_Array::value('class', $props, '') . ' crm-form-entityref'); if (array_key_exists('create', $props) && empty($props['create'])) { @@ -2571,4 +2571,19 @@ class CRM_Core_Form extends HTML_QuickForm_Page { ]); } + /** + * Set the active tab + * + * @param string $default + * + * @throws \CRM_Core_Exception + */ + public function setSelectedChild($default = NULL) { + $selectedChild = CRM_Utils_Request::retrieve('selectedChild', 'Alphanumeric', $this, FALSE, $default); + if (!empty($selectedChild)) { + $this->set('selectedChild', $selectedChild); + $this->assign('selectedChild', $selectedChild); + } + } + }