true,
'message' => __('Incidence type not fields'),
]
);
} else {
$output = '
';
foreach ($customFields as $field) {
$options = [
'name' => 'custom-fields['.$field['idIncidenceTypeField'].']',
'required' => $field['isRequired'],
'return' => true,
];
$class = '';
switch ($field['type']) {
case 'COMBO':
$options['type'] = 'select';
$fieldsValues = explode(',', $field['comboValue']);
$options['fields'] = array_combine($fieldsValues, $fieldsValues);
$options['selected'] = ($fieldsData[$field['idIncidenceTypeField']] ?? null);
break;
case 'TEXT':
$options['value'] = ($fieldsData[$field['idIncidenceTypeField']] ?? null);
$options['type'] = 'text';
break;
case 'CHECKBOX':
$options['checked'] = ($fieldsData[$field['idIncidenceTypeField']] ?? null);
$options['type'] = 'checkbox';
break;
case 'DATE':
$options['value'] = ($fieldsData[$field['idIncidenceTypeField']] ?? null);
$options['type'] = 'text';
break;
case 'NUMERIC':
$options['value'] = ($fieldsData[$field['idIncidenceTypeField']] ?? null);
$options['type'] = 'number';
break;
case 'TEXTAREA':
$options['value'] = ($fieldsData[$field['idIncidenceTypeField']] ?? null);
$options['type'] = 'textarea';
$options['rows'] = 4;
$options['columns'] = 0;
$class = 'incidence-type-custom-fields-textarea';
break;
default:
// Not posible.
break;
}
$output .= html_print_label_input_block(
$field['label'],
html_print_input($options),
['div_class' => $class]
);
}
$output .= '
';
echo $output;
}