mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fixed bug with preivous CheckboxSetField change
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@62648 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
442af1a7ca
commit
a6577d9749
@ -110,9 +110,9 @@ class CheckboxSetField extends OptionsetField {
|
|||||||
/**
|
/**
|
||||||
* Load a value into this CheckboxSetField
|
* Load a value into this CheckboxSetField
|
||||||
*/
|
*/
|
||||||
function setValue($value, $obj) {
|
function setValue($value, $obj = null) {
|
||||||
// If we're not passed a value directly, we can look for it in a relation method on the object passed as a second arg
|
// If we're not passed a value directly, we can look for it in a relation method on the object passed as a second arg
|
||||||
if(!$value && $obj instanceof DataObject && $obj->hasMethod($this->name)) {
|
if(!$value && $obj && $obj instanceof DataObject && $obj->hasMethod($this->name)) {
|
||||||
$funcName = $this->name;
|
$funcName = $this->name;
|
||||||
$selected = $obj->$funcName();
|
$selected = $obj->$funcName();
|
||||||
$value = $selected->toDropdownMap('ID','ID');
|
$value = $selected->toDropdownMap('ID','ID');
|
||||||
|
Loading…
Reference in New Issue
Block a user