Skip to content
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
6 changes: 6 additions & 0 deletions en/appendices/5-3-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,9 @@ View

- ``ViewBuilder::getConfigMergeStrategy()`` was added to retrieve the current merge
strategy setting.

- :php:meth:`PaginatorHelper::limitControl()` now automatically respects the
``maxLimit`` configuration from the paginator, filtering out any limit options
that exceed it. A new ``steps`` option was added to automatically generate limit
options in multiples of a specific value (e.g., ``['steps' => 10]`` generates
10, 20, 30... up to maxLimit).
36 changes: 36 additions & 0 deletions en/views/helpers/paginator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,42 @@ Create a dropdown control that changes the ``limit`` query parameter::

The generated form and control will automatically submit on change.

Automatic Limit Generation with Steps
--------------------------------------

Instead of manually defining limit options, you can use the ``steps`` option to
automatically generate limits in multiples of a specific value::

// Generate limits in steps of 10 up to maxLimit
echo $this->Paginator->limitControl([], null, ['steps' => 10]);
// With maxLimit of 50, this generates: 10, 20, 30, 40, 50

// Steps of 25 up to maxLimit or 100 (whichever is lower)
echo $this->Paginator->limitControl([], null, ['steps' => 25]);

When using ``steps``, you cannot also provide explicit limits in the ``$limits``
parameter - you must use one or the other.

Respecting maxLimit
-------------------

The ``limitControl()`` method automatically respects the ``maxLimit`` configuration
from your paginator settings. Any limit options that exceed the ``maxLimit`` will
be automatically filtered out::

// In your controller with maxLimit of 50
$this->paginate = [
'limit' => 20,
'maxLimit' => 50,
];

// In your template - limits above 50 are filtered out
echo $this->Paginator->limitControl([20 => 20, 50 => 50, 100 => 100]);
// Only shows: 20, 50

If all default or provided limits exceed the ``maxLimit``, the control will
automatically use the ``maxLimit`` value as the only available option.

Configuring Pagination Options
==============================

Expand Down
Loading