diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 8c7f3d0aa9ee..9046d80a2648 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1075,6 +1075,10 @@ public static function addQuickFormElement( $qf->assign('customUrls', $customUrls); break; + + case 'Hidden': + $element = $qf->add('hidden', $elementName); + break; } switch ($field->data_type) { @@ -1376,6 +1380,10 @@ private static function formatDisplayValue($value, $field, $entityId = NULL) { $display = implode(', ', $values); } break; + + case 'Hidden': + $display = ''; + break; } return $display; } diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 87fa71eba7af..51497ec9f077 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -219,6 +219,11 @@ public static function customHtmlType() { 'name' => 'Link', 'label' => ts('Link'), ], + [ + 'id' => 'Hidden', + 'name' => 'Hidden', + 'label' => ts('Hidden'), + ], ]; } diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php index a61292f666d6..dfd77a6fb7f0 100644 --- a/CRM/Custom/Form/Field.php +++ b/CRM/Custom/Form/Field.php @@ -58,10 +58,10 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { * @var array[] */ public static $_dataToHTML = [ - 'String' => ['Text', 'Select', 'Radio', 'CheckBox', 'Autocomplete-Select'], - 'Int' => ['Text', 'Select', 'Radio'], - 'Float' => ['Text', 'Select', 'Radio'], - 'Money' => ['Text', 'Select', 'Radio'], + 'String' => ['Text', 'Select', 'Radio', 'CheckBox', 'Autocomplete-Select', 'Hidden'], + 'Int' => ['Text', 'Select', 'Radio', 'Hidden'], + 'Float' => ['Text', 'Select', 'Radio', 'Hidden'], + 'Money' => ['Text', 'Select', 'Radio', 'Hidden'], 'Memo' => ['TextArea', 'RichTextEditor'], 'Date' => ['Select Date'], 'Boolean' => ['Radio'], diff --git a/Civi/Api4/Generic/BasicGetFieldsAction.php b/Civi/Api4/Generic/BasicGetFieldsAction.php index 895701f2adb7..dae4a7b6a617 100644 --- a/Civi/Api4/Generic/BasicGetFieldsAction.php +++ b/Civi/Api4/Generic/BasicGetFieldsAction.php @@ -324,6 +324,7 @@ public function fields() { 'Email' => ts('Email'), 'EntityRef' => ts('Autocomplete Entity'), 'File' => ts('File'), + 'Hidden' => ts('Hidden'), 'Location' => ts('Address Location'), 'Number' => ts('Number'), 'Radio' => ts('Radio Buttons'), diff --git a/ext/afform/admin/ang/afGuiEditor/inputType/Hidden.html b/ext/afform/admin/ang/afGuiEditor/inputType/Hidden.html new file mode 100644 index 000000000000..c19e65aec0fc --- /dev/null +++ b/ext/afform/admin/ang/afGuiEditor/inputType/Hidden.html @@ -0,0 +1 @@ +
diff --git a/ext/afform/core/ang/af/fields/Hidden.html b/ext/afform/core/ang/af/fields/Hidden.html new file mode 100644 index 000000000000..3a274235c055 --- /dev/null +++ b/ext/afform/core/ang/af/fields/Hidden.html @@ -0,0 +1 @@ + diff --git a/templates/CRM/Custom/Form/Field.tpl b/templates/CRM/Custom/Form/Field.tpl index 68733a0d087c..4ae1b1ed538c 100644 --- a/templates/CRM/Custom/Form/Field.tpl +++ b/templates/CRM/Custom/Form/Field.tpl @@ -270,7 +270,7 @@ } if (_.includes(['String', 'Int', 'Float', 'Money'], dataType)) { - if (htmlType !== "Text") { + if (!['Text', 'Hidden'].includes(htmlType)) { $("#showoption, #searchable", $form).show(); $("#hideDefault, #hideDesc, #searchByRange", $form).hide(); } else { @@ -289,7 +289,7 @@ $("#showoption").hide(); } - if (_.includes(['String', 'Int', 'Float', 'Money'], dataType) && htmlType !== 'Text') { + if (_.includes(['String', 'Int', 'Float', 'Money'], dataType) && !['Text', 'Hidden'].includes(htmlType)) { if (serialize) { $('div[id^=checkbox]', '#optionField').show(); $('div[id^=radio]', '#optionField').hide();