mirror of
https://github.com/UndefinedOffset/SortableGridField.git
synced 2024-10-22 17:05:38 +02:00
NEW Extend new AbstractGridFieldComponent class
This makes the `GridFieldSortableRows` component `Injectable`, and allows any future enhancements in the new abstract class to automatically apply without requiring additional changes in this module. The class is introduced in silverstripe/framework 4.11.0 so the dependency constraint needs to be updated.
This commit is contained in:
parent
fff3f08901
commit
e374c93ae3
@ -12,7 +12,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"silverstripe/framework": "~4.0",
|
||||
"silverstripe/framework": "~4.11",
|
||||
"silverstripe/versioned": "^1.0",
|
||||
"silverstripe/vendor-plugin": "^1.0"
|
||||
},
|
||||
|
@ -19,7 +19,7 @@ class TestPage extends Page
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$conf = GridFieldConfig_RelationEditor::create(10);
|
||||
$conf->addComponent(new GridFieldSortableRows('SortOrder'));
|
||||
$conf->addComponent(GridFieldSortableRows::create('SortOrder'));
|
||||
|
||||
$fields->addFieldToTab(
|
||||
'Root.TestObjects',
|
||||
|
@ -25,9 +25,9 @@ class TestPage extends Page
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$conf = GridFieldConfig_RelationEditor::create(10);
|
||||
$conf->addComponent(new GridFieldSortableRows('SortOrder'));
|
||||
$conf->addComponent(GridFieldSortableRows::create('SortOrder'));
|
||||
|
||||
$fields->addFieldToTab('Root.TestObjects', new GridField('TestObjects', 'TestObjects', $this->TestObjects(), $conf));
|
||||
$fields->addFieldToTab('Root.TestObjects', GridField::create('TestObjects', 'TestObjects', $this->TestObjects(), $conf));
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class MyModelAdmin extends ModelAdmin
|
||||
|
||||
// This is just a precaution to ensure we got a GridField from dataFieldByName() which you should have
|
||||
if ($gridField instanceof GridField) {
|
||||
$gridField->getConfig()->addComponent(new GridFieldSortableRows('SortOrder'));
|
||||
$gridField->getConfig()->addComponent(GridFieldSortableRows::create('SortOrder'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ use SilverStripe\Core\ClassInfo;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Extensible;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Forms\GridField\AbstractGridFieldComponent;
|
||||
use SilverStripe\Forms\GridField\GridField;
|
||||
use SilverStripe\Forms\GridField\GridField_ActionProvider;
|
||||
use SilverStripe\Forms\GridField\GridField_DataManipulator;
|
||||
@ -36,7 +37,7 @@ use SilverStripe\View\Requirements;
|
||||
*
|
||||
* @package forms
|
||||
*/
|
||||
class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionProvider, GridField_DataManipulator
|
||||
class GridFieldSortableRows extends AbstractGridFieldComponent implements GridField_HTMLProvider, GridField_ActionProvider, GridField_DataManipulator
|
||||
{
|
||||
/** @var string */
|
||||
protected $sortColumn;
|
||||
|
Loading…
Reference in New Issue
Block a user