Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

API CHANGE Renamed GridFieldDefaultColumns to GridFieldDataColumns #6921

  • Loading branch information...
commit 09d6fa7bb3915d6caa8426c494e73d499ca08287 1 parent 6d0b0d6
@stojg stojg authored
View
10 docs/en/topics/grid-field.md
@@ -32,7 +32,7 @@ This example creates exactly the same kind of grid as the previous example, but
// Provide a header row with filter controls
$config->addComponent(new GridFieldFilterHeader());
// Provide a default set of columns based on $summary_fields
- $config->addComponent(new GridFieldDefaultColumns());
+ $config->addComponent(new GridFieldDataColumns());
// Provide a header row with sort controls
$config->addComponent(new GridFieldSortableHeader());
// Paginate results to 25 items per page, and show a footer with pagination controls
@@ -44,7 +44,7 @@ If we wanted to make a simpler grid without pagination or filtering, we could do
:::php
$config = GridFieldConfig::create();
// Provide a default set of columns based on $summary_fields
- $config->addComponent(new GridFieldDefaultColumns());
+ $config->addComponent(new GridFieldDataColumns());
// Provide a header row with sort controls
$config->addComponent(new GridFieldPaginator(25));
$field = new GridField("Members", "Members of this group", $this->group->Members(), $config);
@@ -57,11 +57,11 @@ A `GridFieldConfig` is made up of a new of `GridFieldComponent` objects, which a
`GridFieldComponent` is a family of interfaces.
SilverStripe Framework comes with the following components that you can use out of the box.
-### GridFieldDefaultColumns
+### GridFieldDataColumns
This is the one component that, in most cases, you must include. It provides the default columns, sourcing them from the underlying DataObject's `$summary_fields` if no specific configuration is provided.
-Without GridFieldDefaultColumns added to a GridField, it would have no columns whatsoever. Although this isn't particularly useful most of the time, we have allowed for this for two reasons:
+Without GridFieldDataColumns added to a GridField, it would have no columns whatsoever. Although this isn't particularly useful most of the time, we have allowed for this for two reasons:
* You may have a grid whose fields are generated purely by another non-standard component.
* It keeps the core of the GridField lean, focused solely on providing APIs to the components.
@@ -233,7 +233,7 @@ By default, a grid contains no columns. All the columns displayed in a grid wil
For example, you may create a grid field with several components providing columns:
- * `GridFieldDefaultColumns` could provide basic data columns.
+ * `GridFieldDataColumns` could provide basic data columns.
* An editor component could provide a column containing action buttons on the right.
* A multiselect component clould provide a column showing a checkbox on the left.
View
2  forms/HtmlEditorField.php
@@ -356,7 +356,7 @@ function MediaForm() {
$fileFieldConfig = GridFieldConfig::create();
$fileFieldConfig->addComponent(new GridFieldSortableHeader());
$fileFieldConfig->addComponent(new GridFieldFilterHeader());
- $fileFieldConfig->addComponent(new GridFieldDefaultColumns());
+ $fileFieldConfig->addComponent(new GridFieldDataColumns());
$fileFieldConfig->addComponent(new GridFieldPaginator(5));
$fileField = new GridField('Files', false, null, $fileFieldConfig);
$fileField->setList($this->getFiles($parentID));
View
2  forms/UploadField.php
@@ -847,7 +847,7 @@ protected function getListField() {
$config = GridFieldConfig::create();
$config->addComponent(new GridFieldSortableHeader());
$config->addComponent(new GridFieldFilterHeader());
- $config->addComponent(new GridFieldDefaultColumns());
+ $config->addComponent(new GridFieldDataColumns());
$config->addComponent(new GridFieldPaginator(10));
$field = new GridField('Files', false, $folder->stageChildren(), $config);
View
2  forms/gridfield/GridField.php
@@ -404,7 +404,7 @@ public function FieldHolder() {
array(
"class" => implode(' ', $classes),
'data-id' => $record->ID,
- // TODO Allow per-row customization similar to GridFieldDefaultColumns
+ // TODO Allow per-row customization similar to GridFieldDataColumns
'data-class' => $record->ClassName,
),
$rowContent
View
2  forms/gridfield/GridFieldComponent.php
@@ -36,7 +36,7 @@ function getHTMLFragments($gridField);
/**
* Modify the list of columns displayed in the table.
- * See {@link GridField->getDisplayFields()} and {@link GridFieldDefaultColumns}.
+ * See {@link GridField->getDisplayFields()} and {@link GridFieldDataColumns}.
*
* @param GridField
* @param Array List reference of all column names.
View
6 forms/gridfield/GridFieldConfig.php
@@ -134,7 +134,7 @@ public function __construct($itemsPerPage=null) {
$this->addComponent(new GridFieldToolbarHeader());
$this->addComponent(new GridFieldSortableHeader());
$this->addComponent(new GridFieldFilterHeader());
- $this->addComponent(new GridFieldDefaultColumns());
+ $this->addComponent(new GridFieldDataColumns());
$this->addComponent(new GridFieldPaginator($itemsPerPage));
}
}
@@ -161,7 +161,7 @@ public function __construct($itemsPerPage=null) {
$this->addComponent(new GridFieldToolbarHeader());
$this->addComponent(new GridFieldSortableHeader());
$this->addComponent(new GridFieldFilterHeader());
- $this->addComponent(new GridFieldDefaultColumns());
+ $this->addComponent(new GridFieldDataColumns());
$this->addComponent(new GridFieldEditButton());
$this->addComponent(new GridFieldDeleteAction());
$this->addComponent(new GridFieldPaginator($itemsPerPage));
@@ -204,7 +204,7 @@ public function __construct($itemsPerPage=null) {
$this->addComponent(new GridFieldAddExistingAutocompleter());
$this->addComponent(new GridFieldSortableHeader());
$this->addComponent(new GridFieldFilterHeader());
- $this->addComponent(new GridFieldDefaultColumns());
+ $this->addComponent(new GridFieldDataColumns());
$this->addComponent(new GridFieldEditButton());
$this->addComponent(new GridFieldDeleteAction(true));
$this->addComponent(new GridFieldPaginator($itemsPerPage));
View
2  forms/gridfield/GridFieldDefaultColumns.php → forms/gridfield/GridFieldDataColumns.php
@@ -6,7 +6,7 @@
* @package sapphire
* @subpackage fields-relational
*/
-class GridFieldDefaultColumns implements GridField_ColumnProvider {
+class GridFieldDataColumns implements GridField_ColumnProvider {
public function augmentColumns($gridField, &$columns) {
$baseColumns = array_keys($gridField->getDisplayFields());
View
8 tests/forms/GridFieldTest.php
@@ -32,7 +32,7 @@ public function testGridFieldDefaultConfig() {
new GridFieldToolbarHeader(),
new GridFieldSortableHeader,
new GridFieldFilterHeader,
- new GridFieldDefaultColumns,
+ new GridFieldDataColumns,
new GridFieldPaginator,
new GridState_Component,
));
@@ -48,13 +48,13 @@ public function testGridFieldSetCustomConfig() {
$config = GridFieldConfig::create();
$config->addComponent(new GridFieldSortableHeader());
- $config->addComponent(new GridFieldDefaultColumns());
+ $config->addComponent(new GridFieldDataColumns());
$obj = new GridField('testfield', 'testfield', ArrayList::create(array()),$config);
$expectedComponents = new ArrayList(array(
0 => new GridFieldSortableHeader,
- 1 => new GridFieldDefaultColumns,
+ 1 => new GridFieldDataColumns,
2 => new GridState_Component,
));
@@ -430,7 +430,7 @@ public function testCanViewOnlyOddIDs() {
));
$config = new GridFieldConfig();
- $config->addComponent(new GridFieldDefaultColumns());
+ $config->addComponent(new GridFieldDataColumns());
$obj = new GridField('testfield', 'testfield', $list, $config);
$form = new Form(new Controller(), 'mockform', new FieldList(array($obj)), new FieldList());
$content = new CSSContentParser($obj->FieldHolder());
View
2  tests/forms/gridfield/GridFieldAddExistingAutocompleterTest.php
@@ -75,7 +75,7 @@ function Form() {
$player = DataObject::get('GridFieldTest_Player')->find('Email', 'player1@test.com');
$config = GridFieldConfig::create()->addComponents(
$relationComponent = new GridFieldAddExistingAutocompleter('Name'),
- new GridFieldDefaultColumns()
+ new GridFieldDataColumns()
);
$field = new GridField('testfield', 'testfield', $player->Teams(), $config);
return new Form($this, 'Form', new FieldList($field), new FieldList());
Please sign in to comment.
Something went wrong with that request. Please try again.