Skip to content
Merged
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
15 changes: 9 additions & 6 deletions src/Admin/AbstractAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ abstract class AbstractAdmin extends AbstractTaggedAdmin implements AdminInterfa
private const MASK_OF_ACTION_LIST = self::ACTION_SHOW | self::ACTION_EDIT | self::ACTION_DELETE | self::ACTION_ACL | self::ACTION_BATCH;
private const MASK_OF_ACTIONS_USING_OBJECT = self::MASK_OF_ACTION_SHOW | self::MASK_OF_ACTION_EDIT | self::MASK_OF_ACTION_HISTORY | self::MASK_OF_ACTION_ACL;

private const DEFAULT_LIST_PER_PAGE_RESULTS = 32;
private const DEFAULT_LIST_PER_PAGE_OPTIONS = [16, 32, 64, 128, 256];

/**
* The list FieldDescription constructed from the configureListField method.
*
Expand Down Expand Up @@ -139,7 +142,7 @@ abstract class AbstractAdmin extends AbstractTaggedAdmin implements AdminInterfa
*
* @var int
*/
protected $maxPerPage = 32;
protected $maxPerPage = self::DEFAULT_LIST_PER_PAGE_RESULTS;

/**
* The maximum number of page numbers to display in the list.
Expand Down Expand Up @@ -196,7 +199,7 @@ abstract class AbstractAdmin extends AbstractTaggedAdmin implements AdminInterfa
*/
protected $datagridValues = [
DatagridInterface::PAGE => 1,
DatagridInterface::PER_PAGE => 32,
DatagridInterface::PER_PAGE => self::DEFAULT_LIST_PER_PAGE_RESULTS,
];

/**
Expand All @@ -208,7 +211,7 @@ abstract class AbstractAdmin extends AbstractTaggedAdmin implements AdminInterfa
*
* @var array
*/
protected $perPageOptions = [16, 32, 64, 128, 256];
protected $perPageOptions = self::DEFAULT_LIST_PER_PAGE_OPTIONS;

/**
* Array of routes related to this admin.
Expand Down Expand Up @@ -1605,7 +1608,7 @@ public function getMaxPerPage()
return $this->maxPerPage;
// $sortValues = $this->getDefaultSortValues();

// return $sortValues[DatagridInterface::PER_PAGE] ?? 25;
// return $sortValues[DatagridInterface::PER_PAGE] ?? self::DEFAULT_LIST_PER_PAGE_RESULTS;
}

/**
Expand Down Expand Up @@ -2656,7 +2659,7 @@ public function getPerPageOptions()
{
// NEXT_MAJOR: Remove this line and uncomment the following
return $this->perPageOptions;
// $perPageOptions = [10, 25, 50, 100, 250];
// $perPageOptions = self::DEFAULT_LIST_PER_PAGE_OPTIONS;
// $perPageOptions[] = $this->getMaxPerPage();
//
// $perPageOptions = array_unique($perPageOptions);
Expand Down Expand Up @@ -3146,7 +3149,7 @@ final protected function getDefaultSortValues(): array
{
// NEXT_MAJOR: Use the next line instead.
$defaultSortValues = [];
// $defaultSortValues = [DatagridInterface::PAGE => 1, DatagridInterface::PER_PAGE => 25];
// $defaultSortValues = [DatagridInterface::PAGE => 1, DatagridInterface::PER_PAGE => self::DEFAULT_LIST_PER_PAGE_RESULTS];

$this->configureDefaultSortValues($defaultSortValues);

Expand Down