Skip to content

Commit

Permalink
LimitControl: Reset page param to 1 if set
Browse files Browse the repository at this point in the history
fixes #218
  • Loading branch information
nilmerg committed Apr 9, 2024
1 parent a414129 commit de9f622
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Control/LimitControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,11 @@ protected function assemble()
'title' => t('Change item count per page'),
'value' => $limit
]);

if ($this->url->hasParam(PaginationControl::DEFAULT_PAGE_PARAM)) {
$this->addElement('hidden', PaginationControl::DEFAULT_PAGE_PARAM, [
'value' => 1
]);
}
}
}
3 changes: 3 additions & 0 deletions src/Control/PaginationControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
*/
class PaginationControl extends BaseHtmlElement
{
/** @var string Default page parameter */
public const DEFAULT_PAGE_PARAM = 'page';

/** @var int Default maximum number of items which should be shown per page */
protected $defaultPageSize;

Expand Down

0 comments on commit de9f622

Please sign in to comment.