mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 11:05:32 +02:00
Fixing setValue null value bug
On occasions when a form is submitted `StringTagField` throws an error saying `ERROR [Warning]: array_filter() expects parameter 1 to be array, null given` at the end of the `setValue` function. I have added some code that checks if `$value` is `null`. If it is `null` it sets `$value` to an empty array to prevent the error from occurring.
This commit is contained in:
parent
96c48ab136
commit
be0565c660
@ -223,6 +223,10 @@ class StringTagField extends DropdownField
|
||||
$value = $source->column('ID');
|
||||
}
|
||||
|
||||
if (is_null($value)) {
|
||||
$value = array();
|
||||
}
|
||||
|
||||
return parent::setValue(array_filter($value));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user