diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index f60505d34b..8b75e3a91e 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -1632,9 +1632,9 @@ public function ListViewForm() } $list = $this->getList($params, $parentID); $gridFieldConfig = GridFieldConfig::create()->addComponents( - new GridFieldSortableHeader(), - new GridFieldDataColumns(), - new GridFieldPaginator($this->config()->get('page_length')) + Injector::inst()->create(GridFieldSortableHeader::class), + Injector::inst()->create(GridFieldDataColumns::class), + Injector::inst()->createWithArgs(GridFieldPaginator::class, [$this->config()->get('page_length')]) ); if ($parentID) { $linkSpec = $this->LinkListViewChildren('%d'); @@ -1645,7 +1645,7 @@ public function ListViewForm() ); $this->setCurrentPageID($parentID); } - $gridField = new GridField('Page', 'Pages', $list, $gridFieldConfig); + $gridField = GridField::create('Page', 'Pages', $list, $gridFieldConfig); $gridField->setAttribute('cms-loading-ignore-url-params', true); /** @var GridFieldDataColumns $columns */ $columns = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class); diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 6d7bdf9339..3f525f4b4c 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -1996,7 +1996,7 @@ public function getCMSFields() ); } ]); - $dependentTable->getConfig()->addComponent(new GridFieldLazyLoader()); + $dependentTable->getConfig()->addComponent(Injector::inst()->create(GridFieldLazyLoader::class)); } $baseLink = Controller::join_links(