mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
APICHANGE: add updateFieldLabels() to DataObjectDecorator, so as that a dataobject could update fieldLables by its decorator.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64805 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
bff5942338
commit
27a868ebf2
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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'])){
|
||||
|
Loading…
Reference in New Issue
Block a user