From 6a14bfbcc13476e3128ecb6653a2ae110fe505a2 Mon Sep 17 00:00:00 2001 From: Samuel Mulliss Date: Thu, 17 Sep 2020 14:14:35 +1200 Subject: [PATCH] Update ModelAdminExample.md adding semicolon, readability. --- docs/ModelAdminExample.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/ModelAdminExample.md b/docs/ModelAdminExample.md index c759b89..0c9c7ce 100644 --- a/docs/ModelAdminExample.md +++ b/docs/ModelAdminExample.md @@ -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')); } }