namespace wcf\acp\page;
use wcf\page\AbstractGridViewPage;
+use wcf\system\view\grid\AbstractGridView;
use wcf\system\view\grid\UserRankGridView;
/**
*/
public $neededModules = ['MODULE_USER_RANK'];
- /**
- * @inheritDoc
- */
- protected string $gridViewClassName = UserRankGridView::class;
+ #[\Override]
+ protected function createGridViewController(): AbstractGridView
+ {
+ return new UserRankGridView();
+ }
}
namespace wcf\page;
-use wcf\system\exception\ParentClassException;
-use wcf\system\exception\SystemException;
use wcf\system\request\LinkHandler;
use wcf\system\view\grid\AbstractGridView;
use wcf\system\WCF;
abstract class AbstractGridViewPage extends AbstractPage
{
- protected string $gridViewClassName;
protected AbstractGridView $gridView;
protected int $pageNo = 1;
protected string $sortField = '';
protected function initGridView(): void
{
- if (!isset($this->gridViewClassName)) {
- throw new SystemException('Grid view class name not specified.');
- }
-
- if (!\is_subclass_of($this->gridViewClassName, AbstractGridView::class)) {
- throw new ParentClassException($this->gridViewClassName, AbstractGridView::class);
- }
-
- $this->gridView = new $this->gridViewClassName;
+ $this->gridView = $this->createGridViewController();
if ($this->sortField) {
$this->gridView->setSortField($this->sortField);
$this->gridView->setPageNo($this->pageNo);
$this->gridView->setBaseUrl(LinkHandler::getInstance()->getControllerLink(static::class));
}
+
+ protected abstract function createGridViewController(): AbstractGridView;
}