diff --git a/core/model/DataObject.php b/core/model/DataObject.php index 67e82d455..b86b3331a 100644 --- a/core/model/DataObject.php +++ b/core/model/DataObject.php @@ -2541,8 +2541,10 @@ class DataObject extends ViewableData implements DataObjectInterface { $autoLabels[$name] = FormField::name_to_label($name); } } - - return array_merge((array)$autoLabels, (array)$customLabels); + $labels = array_merge((array)$autoLabels, (array)$customLabels); + $this->extend('updateFieldLabels', $labels); + + return $labels; } /** diff --git a/core/model/DataObjectDecorator.php b/core/model/DataObjectDecorator.php index 29171e1eb..0017f18a9 100755 --- a/core/model/DataObjectDecorator.php +++ b/core/model/DataObjectDecorator.php @@ -137,6 +137,20 @@ abstract class DataObjectDecorator extends Extension { } } + /** + * this function is used to provide modifications to the fields labels in CMS + * by the decorator + * By default, the fieldLabels() of its owner will merge more fields defined in the decorator's + * $extra_fields['field_labels'] + */ + function updateFieldLabels(&$lables){ + $extra_fields = $this->extraDBFields(); + if(isset($extra_fields['field_labels'])){ + $field_labels = $extra_fields['field_labels']; + if($field_labels) $lables = array_merge($lables, $field_labels); + } + } + function updateSummaryFieldsExcludeExtra(&$fields){ $extra_fields = $this->extraDBFields(); if(isset($extra_fields['summary_fields'])){