From b4031bcd8e44fd6e33518857bbd39899c1a1b700 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 21 Oct 2024 16:04:04 +1300 Subject: [PATCH] API Check is instance of SS_List --- src/GridFieldConfigurablePaginator.php | 3 +-- src/GridFieldNestedForm.php | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/GridFieldConfigurablePaginator.php b/src/GridFieldConfigurablePaginator.php index f11034e..51a037c 100644 --- a/src/GridFieldConfigurablePaginator.php +++ b/src/GridFieldConfigurablePaginator.php @@ -9,7 +9,6 @@ use SilverStripe\Forms\GridField\GridFieldPaginator; use SilverStripe\Forms\GridField\GridState_Data; use SilverStripe\Model\List\ArrayList; -use SilverStripe\Model\List\Limitable; use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\UnsavedRelationList; use SilverStripe\Model\ArrayData; @@ -256,7 +255,7 @@ public function getManipulatedData(GridField $gridField, SS_List $dataList) $this->setItemsPerPage($state->pageSize); } - if (!($dataList instanceof Limitable) || ($dataList instanceof UnsavedRelationList)) { + if (!($dataList instanceof SS_List) || ($dataList instanceof UnsavedRelationList)) { return $dataList; } diff --git a/src/GridFieldNestedForm.php b/src/GridFieldNestedForm.php index 3c8fc51..1266c03 100644 --- a/src/GridFieldNestedForm.php +++ b/src/GridFieldNestedForm.php @@ -23,7 +23,6 @@ use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\Model\List\Filterable; use SilverStripe\ORM\Hierarchy\Hierarchy; use SilverStripe\Model\List\SS_List; use SilverStripe\Versioned\Versioned; @@ -362,7 +361,7 @@ public function handleNestedItem( throw new Exception('Max nesting level reached'); } $list = $gridField->getList(); - if (!$record && $request && $list instanceof Filterable) { + if (!$record && $request && $list instanceof SS_List) { $recordID = $request->param('RecordID'); $record = $list->byID($recordID); } @@ -411,7 +410,7 @@ public function toggleNestedItem( ModelData|null $record = null ) { $list = $gridField->getList(); - if (!$record && $request && $list instanceof Filterable) { + if (!$record && $request && $list instanceof SS_List) { $recordID = $request->param('RecordID'); $record = $list->byID($recordID); } @@ -460,7 +459,7 @@ public function handleSave(GridField $gridField, DataObjectInterface $record) } foreach ($request->postVars() as $key => $val) { $list = $gridField->getList(); - if ($list instanceof Filterable + if ($list instanceof SS_List && preg_match("/{$gridField->getName()}-{$postKey}-(\d+)/", $key, $matches) ) { $recordID = $matches[1]; @@ -482,7 +481,7 @@ public function getManipulatedData(GridField $gridField, SS_List $dataList) && is_a($gridField->getModelClass(), DataObject::class, true) && DataObject::has_extension($gridField->getModelClass(), Hierarchy::class) && $gridField->getForm()->getController() instanceof ModelAdmin - && $dataList instanceof Filterable + && $dataList instanceof SS_List ) { $dataList = $dataList->filter('ParentID', 0); }