The config settings for pagination are applied only to the product list and the wishlist items.
If you want to use the same restrictions in your own pagination you need to set them manually.
I assume you have somewhere in a class an instance of the page block \Magento\Theme\Block\Html\Pager
. Let's call the instance $pager
.
I alsi assume you do something like this $pager->setCollection(...)
.
You can apply the "frame" and "skip" limitations like this
$pager->setFrameLenght(2);
$pager->setJump(2);
If you want to use the same values as listed in config you need to do this
$pager->setFrameLength(
$this->scopeConfig->getValue(
'design/pagination/pagination_frame',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$pager->setJump(
$this->scopeConfig->getValue(
'design/pagination/pagination_frame_skip',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
where $this->scopeConfig
is an instance of \Magento\Framework\App\Config\ScopeConfigInterface
that you can add as dependency to your class that uses the pager.
/** @var `Magento\Framework\App\Config\ScopeConfigInterface */
private $scopeConfig;
public function __construct(
...
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
) {
....
$this->scopeConfig = $scopeConfig;
}