Commit 41cddc7e by Carsten Brandt

Merge pull request #3537 from arturf/master

Hide output in LinkPager when only one page exist
parents 8dd3fad7 5a1702e7
......@@ -59,6 +59,7 @@ Yii Framework 2 Change Log
- Enh: Added `all` option to `MigrateController::actionDown()` action (creocoder, umneeq)
- Enh: Added support for array attributes in `exist` validator (creocoder)
- Enh: Added support for using path alias with `FileDependency::fileName` (qiangxue)
- Enh: Added param `hideOnSinglePage` to `yii\widgets\LinkPager` (arturf)
- Chg #2913: RBAC `DbManager` is now initialized via migration (samdark)
- Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue)
- Chg #3175: InvalidCallException, InvalidParamException, UnknownMethodException are now extended from SPL BadMethodCallException (samdark)
......
......@@ -98,6 +98,10 @@ class LinkPager extends Widget
* @see registerLinkTags()
*/
public $registerLinkTags = false;
/**
* @var boolean Hide widget when only one page exist. Defaults to `false`.
*/
public $hideOnSinglePage = false;
/**
* Initializes the pager.
......@@ -140,9 +144,12 @@ class LinkPager extends Widget
*/
protected function renderPageButtons()
{
$buttons = [];
$pageCount = $this->pagination->getPageCount();
if ($pageCount < 2 && $this->hideOnSinglePage) {
return '';
}
$buttons = [];
$currentPage = $this->pagination->getPage();
// first page
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment