Correcting docs around summary field relabelling

Although this is weird that it doesn't use the same logic and searchable fields.
This commit is contained in:
John Milmine 2017-12-06 23:00:15 +13:00 committed by Loz Calver
parent 7215637673
commit 1fb4c6f39f

View File

@ -227,6 +227,32 @@ class MyDataObject extends DataObject
```
In order to re-label any summary fields, you can use the $field_labels static.
```php
use SilverStripe\ORM\DataObject;
class MyDataObject extends DataObject
{
private static $db = [
'Name' => 'Text',
];
private static $has_one = [
'HeroImage' => 'Image',
];
private static $summary_fields = [
'Name',
'HeroImage.CMSThumbnail',
];
private static $field_labels = [
'Name' => 'Name',
'HeroImage.CMSThumbnail' => 'Hero',
];
}
## Related Documentation
* [SearchFilters](searchfilters)