mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #7893 from open-sausages/pulls/3/the-summary-of-all-parts
This commit is contained in:
commit
dc8c05519a
@ -3753,12 +3753,17 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
* @return array
|
||||
*/
|
||||
public function summaryFields() {
|
||||
$fields = $this->stat('summary_fields');
|
||||
$rawFields = $this->stat('summary_fields');
|
||||
|
||||
// if fields were passed in numeric array,
|
||||
// convert to an associative array
|
||||
if($fields && array_key_exists(0, $fields)) {
|
||||
$fields = array_combine(array_values($fields), array_values($fields));
|
||||
$fields = array();
|
||||
// Merge associative / numeric keys
|
||||
if (is_array($rawFields)) {
|
||||
foreach ($rawFields as $key => $value) {
|
||||
if (is_int($key)) {
|
||||
$key = $value;
|
||||
}
|
||||
$fields[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$fields) {
|
||||
|
Loading…
Reference in New Issue
Block a user