mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Ensure that a single string value (as opposed to an array of
values) is accepted by implode() in CheckboxSetField by casting it as an array.
This commit is contained in:
parent
86bdd167cc
commit
3f68e6f82f
@ -179,7 +179,7 @@ class CheckboxSetField extends OptionsetField {
|
|||||||
if($fieldname && $record && $relation && $relation instanceof RelationList) {
|
if($fieldname && $record && $relation && $relation instanceof RelationList) {
|
||||||
$idList = array();
|
$idList = array();
|
||||||
if($this->value) foreach($this->value as $id => $bool) {
|
if($this->value) foreach($this->value as $id => $bool) {
|
||||||
if($bool) {
|
if($bool) {
|
||||||
$idList[] = $id;
|
$idList[] = $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ class CheckboxSetField extends OptionsetField {
|
|||||||
} elseif($fieldname && $record) {
|
} elseif($fieldname && $record) {
|
||||||
if($this->value) {
|
if($this->value) {
|
||||||
$this->value = str_replace(',', '{comma}', $this->value);
|
$this->value = str_replace(',', '{comma}', $this->value);
|
||||||
$record->$fieldname = implode(",", $this->value);
|
$record->$fieldname = implode(',', (array) $this->value);
|
||||||
} else {
|
} else {
|
||||||
$record->$fieldname = '';
|
$record->$fieldname = '';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user