mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-14 21:30:17 +08:00
Merge pull request #3537 from arturf/master
Hide output in LinkPager when only one page exist
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user