mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX:
1. If DataObjectDecorator::extraFields() return an numeric array for its summary field, it need to convert to associative array like what DataObject did. 2. Not all DataObject has a 'Title' database field, but all DataObject has a 'Title' field due to function DataObject::getTitle() exists. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@70725 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5df67f78d3
commit
dec5108f16
@ -2712,7 +2712,7 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP
|
|||||||
$fields = array();
|
$fields = array();
|
||||||
// try to scaffold a couple of usual suspects
|
// try to scaffold a couple of usual suspects
|
||||||
if ($this->hasField('Name')) $fields['Name'] = 'Name';
|
if ($this->hasField('Name')) $fields['Name'] = 'Name';
|
||||||
if ($this->hasField('Title')) $fields['Title'] = 'Title';
|
if ($this->hasDataBaseField('Title')) $fields['Title'] = 'Title';
|
||||||
if ($this->hasField('Description')) $fields['Description'] = 'Description';
|
if ($this->hasField('Description')) $fields['Description'] = 'Description';
|
||||||
if ($this->hasField('FirstName')) $fields['FirstName'] = 'First Name';
|
if ($this->hasField('FirstName')) $fields['FirstName'] = 'First Name';
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,12 @@ abstract class DataObjectDecorator extends Extension {
|
|||||||
$extra_fields = $this->extraStatics();
|
$extra_fields = $this->extraStatics();
|
||||||
if(isset($extra_fields['summary_fields'])){
|
if(isset($extra_fields['summary_fields'])){
|
||||||
$summary_fields = $extra_fields['summary_fields'];
|
$summary_fields = $extra_fields['summary_fields'];
|
||||||
|
|
||||||
|
// if summary_fields were passed in numeric array,
|
||||||
|
// convert to an associative array
|
||||||
|
if($summary_fields && array_key_exists(0, $summary_fields)) {
|
||||||
|
$summary_fields = array_combine(array_values($summary_fields), array_values($summary_fields));
|
||||||
|
}
|
||||||
if($summary_fields) $fields = array_merge($fields, $summary_fields);
|
if($summary_fields) $fields = array_merge($fields, $summary_fields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user