Commit 5feba594 by Carsten Brandt

Added relational link tags to LinkPager widget

for prev, next, first and last page. http://www.w3.org/TR/html401/struct/links.html#h-12.1.2
parent 8a323795
...@@ -148,6 +148,7 @@ Yii Framework 2 Change Log ...@@ -148,6 +148,7 @@ Yii Framework 2 Change Log
- Enh: Added support for building SQLs with sub-queries (qiangxue) - Enh: Added support for building SQLs with sub-queries (qiangxue)
- Enh: Added `Pagination::getLinks()` (qiangxue) - Enh: Added `Pagination::getLinks()` (qiangxue)
- Enh: Added support for reading page size from query parameters by `Pagination` (qiangxue) - Enh: Added support for reading page size from query parameters by `Pagination` (qiangxue)
- Enh: LinkPager will now register relational link tags in the html header for prev, next, first and last page (cebe)
- Chg #1186: Changed `Sort` to use comma to separate multiple sort fields and use negative sign to indicate descending sort (qiangxue) - Chg #1186: Changed `Sort` to use comma to separate multiple sort fields and use negative sign to indicate descending sort (qiangxue)
- Chg #1519: `yii\web\User::loginRequired()` now returns the `Response` object instead of exiting the application (qiangxue) - Chg #1519: `yii\web\User::loginRequired()` now returns the `Response` object instead of exiting the application (qiangxue)
- Chg #1586: `QueryBuilder::buildLikeCondition()` will now escape special characters and use percentage characters by default (qiangxue) - Chg #1586: `QueryBuilder::buildLikeCondition()` will now escape special characters and use percentage characters by default (qiangxue)
......
...@@ -107,10 +107,24 @@ class LinkPager extends Widget ...@@ -107,10 +107,24 @@ class LinkPager extends Widget
*/ */
public function run() public function run()
{ {
$this->registerLinkTags();
echo $this->renderPageButtons(); echo $this->renderPageButtons();
} }
/** /**
* Registers relational link tags in the html header for prev, next, first and last page.
* These links are generated using [[yii\data\Pagination::getLinks()]].
* @see http://www.w3.org/TR/html401/struct/links.html#h-12.1.2
*/
protected function registerLinkTags()
{
$view = $this->getView();
foreach($this->pagination->getLinks() as $rel => $href) {
$view->registerLinkTag(['rel' => $rel, 'href' => $href], $rel);
}
}
/**
* Renders the page buttons. * Renders the page buttons.
* @return string the rendering result * @return string the rendering result
*/ */
......
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