Skip to content
Snippets Groups Projects
Commit 97e2f5d9 authored by Lucas García's avatar Lucas García
Browse files

Merge branch 'fix/empty-file-field' into 'main'

Allow empty fileupload fields

See merge request coopdevs/website/wp/wp-plugins/wpct-crm-forms!4
parents 74b62b1d 211e0891
No related branches found
No related tags found
No related merge requests found
......@@ -57,8 +57,12 @@ function wpct_crm_forms_parse_form_entry($entry, $form)
function wpct_crm_forms_format_value($value, $field, $input = null)
{
if ($field->type === 'fileupload') {
return implode(',', json_decode($value));
try {
if ($field->type === 'fileupload' && $value && is_string($value)) {
return implode(',', json_decode($value));
}
} catch (Exception $e) {
// do nothing
}
return $value;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment