From e263e05d186ac0a212ce07a37039f66582709b00 Mon Sep 17 00:00:00 2001 From: Marius Strajeru Date: Mon, 9 Feb 2015 14:32:36 +0200 Subject: [PATCH] add url fragment to pager --- app/code/Magento/Theme/Block/Html/Pager.php | 33 ++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/Block/Html/Pager.php b/app/code/Magento/Theme/Block/Html/Pager.php index bb67af11ba6ca..74d9b3d2cfa2b 100644 --- a/app/code/Magento/Theme/Block/Html/Pager.php +++ b/app/code/Magento/Theme/Block/Html/Pager.php @@ -95,6 +95,13 @@ class Pager extends \Magento\Framework\View\Element\Template */ protected $_frameEnd; + /** + * Url Fragment for pagination + * + * @var string|null + */ + protected $_fragment = null; + /** * Set pager data * @@ -246,11 +253,12 @@ public function getLimitVarName() * Set pager limit * * @param array $limits - * @return void + * @return $this */ public function setAvailableLimit(array $limits) { $this->_availableLimit = $limits; + return $this; } /** @@ -435,6 +443,7 @@ public function getPagerUrl($params = []) $urlParams['_current'] = true; $urlParams['_escape'] = true; $urlParams['_use_rewrite'] = true; + $urlParams['_fragment'] = $this->getFragment(); $urlParams['_query'] = $params; return $this->getUrl('*/*/*', $urlParams); @@ -740,4 +749,26 @@ protected function _toHtml() } return ''; } + + /** + * get the url fragment + * + * @return string|null + */ + public function getFragment() + { + return $this->_fragment; + } + + /** + * set the url fragment + * @param $fragment + * + * @return $this + */ + public function setFragment($fragment) + { + $this->_fragment = $fragment; + return $this; + } }