mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 13:58:24 +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 `all` option to `MigrateController::actionDown()` action (creocoder, umneeq)
|
||||||
- Enh: Added support for array attributes in `exist` validator (creocoder)
|
- Enh: Added support for array attributes in `exist` validator (creocoder)
|
||||||
- Enh: Added support for using path alias with `FileDependency::fileName` (qiangxue)
|
- 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 #2913: RBAC `DbManager` is now initialized via migration (samdark)
|
||||||
- Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue)
|
- Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue)
|
||||||
- Chg #3175: InvalidCallException, InvalidParamException, UnknownMethodException are now extended from SPL BadMethodCallException (samdark)
|
- Chg #3175: InvalidCallException, InvalidParamException, UnknownMethodException are now extended from SPL BadMethodCallException (samdark)
|
||||||
|
|||||||
@@ -98,6 +98,10 @@ class LinkPager extends Widget
|
|||||||
* @see registerLinkTags()
|
* @see registerLinkTags()
|
||||||
*/
|
*/
|
||||||
public $registerLinkTags = false;
|
public $registerLinkTags = false;
|
||||||
|
/**
|
||||||
|
* @var boolean Hide widget when only one page exist. Defaults to `false`.
|
||||||
|
*/
|
||||||
|
public $hideOnSinglePage = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the pager.
|
* Initializes the pager.
|
||||||
@@ -140,9 +144,12 @@ class LinkPager extends Widget
|
|||||||
*/
|
*/
|
||||||
protected function renderPageButtons()
|
protected function renderPageButtons()
|
||||||
{
|
{
|
||||||
$buttons = [];
|
|
||||||
|
|
||||||
$pageCount = $this->pagination->getPageCount();
|
$pageCount = $this->pagination->getPageCount();
|
||||||
|
if ($pageCount < 2 && $this->hideOnSinglePage) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$buttons = [];
|
||||||
$currentPage = $this->pagination->getPage();
|
$currentPage = $this->pagination->getPage();
|
||||||
|
|
||||||
// first page
|
// first page
|
||||||
|
|||||||
Reference in New Issue
Block a user