mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #985 from ARNHOE/3.0
SummaryFields doesn't change Title of Field
This commit is contained in:
commit
78015ea3cf
@ -72,14 +72,17 @@ for the search form, override `[api:DataObject->getCustomSearchContext()]` on yo
|
|||||||
The results are shown in a tabular listing, powered by the `[GridField](/reference/grid-field)`,
|
The results are shown in a tabular listing, powered by the `[GridField](/reference/grid-field)`,
|
||||||
more specifically the `[api:GridFieldDataColumns]` component.
|
more specifically the `[api:GridFieldDataColumns]` component.
|
||||||
It looks for a `[api:DataObject::$summary_fields]` static on your model class,
|
It looks for a `[api:DataObject::$summary_fields]` static on your model class,
|
||||||
where you can add or remove columns, or change their title.
|
where you can add or remove columns. To change the title, use `[api:DataObject::$field_labels]`.
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
class Product extends DataObject {
|
class Product extends DataObject {
|
||||||
// ...
|
// ...
|
||||||
|
static $field_labels = array(
|
||||||
|
'Price' => 'Cost' // renames the column to "Cost"
|
||||||
|
);
|
||||||
static $summary_fields = array(
|
static $summary_fields = array(
|
||||||
'Name' => 'Name',
|
'Name',
|
||||||
'Price' => 'Cost', // renames the column to "Cost"
|
'Price',
|
||||||
// leaves out the 'ProductCode' field, removing the column
|
// leaves out the 'ProductCode' field, removing the column
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user