mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Fixed TreeMultiselectField/TreeDropdownField saving with 'unchanged' default values from constructor (from r99581)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@99655 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f44b9941ed
commit
aca3bdf9b8
@ -204,6 +204,8 @@ class TreeDropdownField extends FormField {
|
||||
if( isset($_REQUEST['forceValue']) || $this->value ) {
|
||||
$forceValue = ( isset($_REQUEST['forceValue']) ? $_REQUEST['forceValue'] : $this->value);
|
||||
if(($values = preg_split('/,\s*/', $forceValue)) && count($values)) foreach($values as $value) {
|
||||
if(!is_numeric($value)) continue;
|
||||
|
||||
$obj->markToExpose($this->objectForKey($value));
|
||||
}
|
||||
}
|
||||
|
@ -54,19 +54,21 @@ class TreeMultiselectField extends TreeDropdownField {
|
||||
|
||||
Requirements::css(SAPPHIRE_DIR . '/javascript/tree/tree.css');
|
||||
Requirements::css(SAPPHIRE_DIR . '/css/TreeDropdownField.css');
|
||||
|
||||
|
||||
// Any field values have priority over the relation getters
|
||||
if($this->value) {
|
||||
$items = new DataObjectSet();
|
||||
$ids = explode(',', $this->value);
|
||||
foreach($ids as $id) {
|
||||
if(!is_numeric($id)) continue;
|
||||
|
||||
$item = DataObject::get_by_id($this->sourceObject, $id);
|
||||
if($item) $items->push($item);
|
||||
}
|
||||
} else {
|
||||
$items = $this->getItems();
|
||||
}
|
||||
|
||||
|
||||
if($items && $items->Count()) {
|
||||
foreach($items as $item) {
|
||||
$titleArray[] =$item->Title;
|
||||
|
Loading…
x
Reference in New Issue
Block a user