Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Check is instance of SS_List #420

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/GridFieldConfigurablePaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
9 changes: 4 additions & 5 deletions src/GridFieldNestedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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];
Expand All @@ -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);
}
Expand Down