'select' => ['minimumInputLength' => 0],
]);
- if ($this->_action == CRM_Core_Action::UPDATE) {
+ $isUpdateAction = $this->_action == CRM_Core_Action::UPDATE;
+ if ($isUpdateAction) {
$this->freeze('data_type');
if (!empty($this->_values['option_group_id'])) {
$this->assign('hasOptionGroup', in_array($this->_values['html_type'], self::$htmlTypesWithOptions));
$optionGroupParams['id'] = $this->_values['option_group_id'];
$optionGroupParams['options']['or'] = [["is_reserved", "id"]];
}
- $this->assign('originalHtmlType', $this->_values['html_type']);
- $this->assign('originalSerialize', $this->_values['serialize']);
- if (!empty($this->_values['serialize'])) {
- $this->assign('existingMultiValueCount', $this->getMultiValueCount());
- }
}
+ $this->assign('existingMultiValueCount', ($isUpdateAction && !empty($this->_values['serialize'])) ? $this->getMultiValueCount() : NULL);
+ $this->assign('originalSerialize', $isUpdateAction ? $this->_values['serialize'] : NULL);
+ $this->assign('originalHtmlType', $isUpdateAction ? $this->_values['html_type'] : NULL);
// Retrieve optiongroups for selection list
$optionGroupMetadata = civicrm_api3('OptionGroup', 'get', $optionGroupParams);
<td class="label">{$form.serialize.label}</td>
<td class="html-adjust">{$form.serialize.html}</td>
</tr>
- {if !empty($form.in_selector)}
+ {if array_key_exists('in_selector', $form)}
<tr class='crm-custom-field-form-block-in_selector'>
<td class='label'>{$form.in_selector.label}</td>
<td class='html-adjust'>{$form.in_selector.html} {help id="id-in_selector"}</td>