mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-20 08:27:21 +08:00
yii\widgets\LinkPager::$firstPageLabel and yii\widgets\LinkPager::$lastPageLabel now could be set to true in order to use page number as label
This commit is contained in:
@@ -46,6 +46,7 @@ Yii Framework 2 Change Log
|
||||
- Enh: Added `yii\helper\Console::wrapText()` method to wrap indented text by console window width and used it in `yii help` command (cebe)
|
||||
- Enh: Implement batchInsert for oci (nineinchnick)
|
||||
- Enh: Detecting IntegrityException for oci (nineinchnick)
|
||||
- Enh: `yii\widgets\LinkPager::$firstPageLabel` and `yii\widgets\LinkPager::$lastPageLabel` now could be set to true in order to use page number as label (samdark)
|
||||
- Chg #7924: Migrations in history are now ordered by time applied allowing to roll back in reverse order no matter how these were applied (samdark)
|
||||
- Chg: Updated dependency to `cebe/markdown` to version `1.1.x` (cebe)
|
||||
|
||||
|
||||
@@ -83,11 +83,13 @@ class LinkPager extends Widget
|
||||
public $prevPageLabel = '«';
|
||||
/**
|
||||
* @var string|boolean the text label for the "first" page button. Note that this will NOT be HTML-encoded.
|
||||
* If it's specified as true, page number will be used as label.
|
||||
* Default is false that means the "first" page button will not be displayed.
|
||||
*/
|
||||
public $firstPageLabel = false;
|
||||
/**
|
||||
* @var string|boolean the text label for the "last" page button. Note that this will NOT be HTML-encoded.
|
||||
* If it's specified as true, page number will be used as label.
|
||||
* Default is false that means the "last" page button will not be displayed.
|
||||
*/
|
||||
public $lastPageLabel = false;
|
||||
@@ -154,8 +156,9 @@ class LinkPager extends Widget
|
||||
$currentPage = $this->pagination->getPage();
|
||||
|
||||
// first page
|
||||
if ($this->firstPageLabel !== false) {
|
||||
$buttons[] = $this->renderPageButton($this->firstPageLabel, 0, $this->firstPageCssClass, $currentPage <= 0, false);
|
||||
$firstPageLabel = $this->firstPageLabel === true ? '1' : $this->firstPageLabel;
|
||||
if ($firstPageLabel !== false) {
|
||||
$buttons[] = $this->renderPageButton($firstPageLabel, 0, $this->firstPageCssClass, $currentPage <= 0, false);
|
||||
}
|
||||
|
||||
// prev page
|
||||
@@ -181,8 +184,9 @@ class LinkPager extends Widget
|
||||
}
|
||||
|
||||
// last page
|
||||
if ($this->lastPageLabel !== false) {
|
||||
$buttons[] = $this->renderPageButton($this->lastPageLabel, $pageCount - 1, $this->lastPageCssClass, $currentPage >= $pageCount - 1, false);
|
||||
$lastPageLabel = $this->lastPageLabel === true ? $pageCount - 1 : $this->lastPageLabel;
|
||||
if ($lastPageLabel !== false) {
|
||||
$buttons[] = $this->renderPageButton($lastPageLabel, $pageCount - 1, $this->lastPageCssClass, $currentPage >= $pageCount - 1, false);
|
||||
}
|
||||
|
||||
return Html::tag('ul', implode("\n", $buttons), $this->options);
|
||||
|
||||
Reference in New Issue
Block a user