Skip to content

Commit eaf8454

Browse files
committed
Update 4.2 branch to php 7 and replace sortablegridfield with gridfieldextensions
1 parent 987842a commit eaf8454

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ CatalogPage:
8787

8888
#### Drag and drop sorting
8989

90-
You can add drag and drop sorting using GridFieldSortableRows when you add the `sort_column` setting to your configuration.
90+
You can add drag and drop sorting using GridFieldOrderableRows when you add the `sort_column` setting to your configuration.
9191
Uses column `Sort` by default which is default in SiteTree and is added by CatalogDataObjectExtension.
9292

9393
```yml

code/ModelAdmin/CatalogPageAdmin.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function init()
2525
*/
2626
public function getEditForm($id = null, $fields = null)
2727
{
28+
/** @var DataObject|CatalogPageExtension|CatalogDataObjectExtension $model */
2829
$model = singleton($this->modelClass);
2930
if ($model->has_extension('CatalogPageExtension') || $model->has_extension('CatalogDataObjectExtension')) {
3031
$list = $this->getList()->setDataQueryParam(array(
@@ -66,8 +67,8 @@ public function getEditForm($id = null, $fields = null)
6667
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
6768

6869
/** add sorting if we have a field for... */
69-
if (class_exists('GridFieldSortableRows') && $sortField = $model->getSortFieldname()) {
70-
$fieldConfig->addComponent(new GridFieldSortableRows($sortField));
70+
if ($sortField = $model->getSortFieldname()) {
71+
$fieldConfig->addComponent(new GridFieldOrderableRows($sortField));
7172
}
7273
} elseif (method_exists($model, 'getAdminListField')) {
7374
$form = CMSForm::create(

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
}
2222
],
2323
"require": {
24-
"undefinedoffset/sortablegridfield": "^0.6.0",
24+
"php": "^7",
25+
"symbiote/silverstripe-gridfieldextensions": "^2",
2526
"silverstripe/cms": "^3.4",
2627
"unclecheese/betterbuttons": "^1.3.7"
27-
2828
}
2929
}

0 commit comments

Comments
 (0)