Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#996 add url fragment to pager #1031

Merged
merged 1 commit into from
Feb 12, 2015
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
33 changes: 32 additions & 1 deletion app/code/Magento/Theme/Block/Html/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}