$params['date_format'] = Civi::settings()->get('dateInputFormat');
}
- if ($htmlType === 'CheckBox' || $htmlType === 'Multi-Select') {
+ // Checkboxes are always serialized in current schema
+ if ($htmlType == 'CheckBox') {
+ $params['serialize'] = CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND;
+ }
+
+ if (!empty($params['serialize'])) {
if (isset($params['default_checkbox_option'])) {
$defaultArray = [];
foreach (array_keys($params['default_checkbox_option']) as $k => $v) {
'return' => ['title'],
];
+ $this->add('checkbox', 'serialize', ts('Multi-Select'));
+
if ($this->_action == CRM_Core_Action::UPDATE) {
$this->freeze('data_type');
if (!empty($this->_values['option_group_id'])) {
$params['is_search_range'] = 0;
}
+ // Serialization cannot be changed on update
+ if ($this->_id) {
+ unset($params['serialize']);
+ }
+ elseif (strpos($params['html_type'], 'Select') === 0) {
+ $params['serialize'] = $params['serialize'] ? CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND : 'null';
+ }
+ else {
+ $params['serialize'] = $params['html_type'] == 'CheckBox' ? CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND : 'null';
+ }
+
$filter = 'null';
if ($dataTypeKey == 11 && !empty($params['filter_selected'])) {
if ($params['filter_selected'] == 'Advance' && trim(CRM_Utils_Array::value('filter', $params))) {
{/if}
</td>
</tr>
+ <tr class="crm-custom-field-form-block-serialize">
+ <td class="label">{$form.serialize.label}</td>
+ <td class="html-adjust">{$form.serialize.html}</td>
+ </tr>
{if $form.in_selector}
<tr class='crm-custom-field-form-block-in_selector'>
<td class='label'>{$form.in_selector.label}</td>
$("#textLength", $form).toggle(dataType === 'String');
$("#noteColumns, #noteRows, #noteLength", $form).toggle(dataType === 'Memo');
+
+ $(".crm-custom-field-form-block-serialize", $form).toggle(htmlType === 'Select' || htmlType === 'Country' || htmlType === 'StateProvince');
}
$('[name^="data_type"]', $form).change(customOptionHtmlType);