mirror of
https://github.com/UndefinedOffset/SortableGridField.git
synced 2024-10-22 17:05:38 +02:00
Update ModelAdminExample.md
adding semicolon, readability.
This commit is contained in:
parent
51c43642ff
commit
6a14bfbcc1
@ -21,11 +21,12 @@ class MyModelAdmin extends ModelAdmin
|
||||
{
|
||||
$form = parent::getEditForm($id, $fields);
|
||||
|
||||
//This check is simply to ensure you are on the managed model you want adjust accordingly
|
||||
if($this->modelClass === MATestObject::class) {
|
||||
$gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass))
|
||||
//This is just a precaution to ensure we got a GridField from dataFieldByName() which you should have
|
||||
if($gridField instanceof GridField) {
|
||||
// This check is simply to ensure you are on the managed model you want adjust accordingly
|
||||
if ($this->modelClass === MATestObject::class) {
|
||||
$gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass));
|
||||
|
||||
// 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'));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user