mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Checking for existing value on TreeDropdownField->performReadonlyTransformation() - this broke the ReadonlyTransformation on Translatable->updateCMSFields() for the new "ParentID" field in SiteTree->getCMSFields()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@75831 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
928e937ffc
commit
e825a3b118
@ -98,6 +98,9 @@ HTML;
|
|||||||
echo substr(trim($tree), 4,-5);
|
echo substr(trim($tree), 4,-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return DataObject
|
||||||
|
*/
|
||||||
public function getByKey($key) {
|
public function getByKey($key) {
|
||||||
if($this->keyField == 'ID') {
|
if($this->keyField == 'ID') {
|
||||||
return DataObject::get_by_id($this->sourceObject, $key);
|
return DataObject::get_by_id($this->sourceObject, $key);
|
||||||
@ -123,9 +126,13 @@ HTML;
|
|||||||
|
|
||||||
function performReadonlyTransformation() {
|
function performReadonlyTransformation() {
|
||||||
$fieldName = $this->labelField;
|
$fieldName = $this->labelField;
|
||||||
$value = ($this->getByKey($this->value)) ? $this->getByKey($this->value)->$fieldName : '';
|
if($this->value) {
|
||||||
|
$obj = ($this->getByKey($this->value)) ? $this->getByKey($this->value)->$fieldName : '';
|
||||||
|
} else {
|
||||||
|
$obj = null;
|
||||||
|
}
|
||||||
$source = array(
|
$source = array(
|
||||||
$this->value => $value
|
$this->value => $obj
|
||||||
);
|
);
|
||||||
$field = new LookupField($this->name, $this->title, $source);
|
$field = new LookupField($this->name, $this->title, $source);
|
||||||
$field->setValue($this->value);
|
$field->setValue($this->value);
|
||||||
|
Loading…
Reference in New Issue
Block a user