PHP Class yii\widgets\LinkPager

LinkPager works with a [[Pagination]] object which specifies the total number of pages and the current page number. Note that LinkPager only generates the necessary HTML markups. In order for it to look like a real pager, you should provide some CSS styles for it. With the default configuration, LinkPager should look good using Twitter Bootstrap CSS framework. For more details and usage information on LinkPager, see the guide article on pagination.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\base\Widget
显示文件 Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$activePageCssClass the CSS class for the active (currently selected) page button.
$disabledListItemSubTagOptions the options for the disabled tag to be generated inside the disabled list element. In order to customize the html tag, please use the tag key. php $disabledListItemSubTagOptions = ['tag' => 'div', 'class' => 'disabled-div'];
$disabledPageCssClass the CSS class for the disabled page buttons.
$firstPageCssClass the CSS class for the "first" page button.
$firstPageLabel 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.
$hideOnSinglePage Hide widget when only one page exist.
$lastPageCssClass the CSS class for the "last" page button.
$lastPageLabel 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.
$linkOptions HTML attributes for the link in a pager container tag.
$maxButtonCount maximum number of page buttons that can be displayed. Defaults to 10.
$nextPageCssClass the CSS class for the "next" page button.
$nextPageLabel the label for the "next" page button. Note that this will NOT be HTML-encoded. If this property is false, the "next" page button will not be displayed.
$options HTML attributes for the pager container tag.
$pageCssClass the CSS class for the each page button.
$pagination the pagination object that this pager is associated with. You must set this property in order to make LinkPager work.
$prevPageCssClass the CSS class for the "previous" page button.
$prevPageLabel the text label for the previous page button. Note that this will NOT be HTML-encoded. If this property is false, the "previous" page button will not be displayed.
$registerLinkTags whether to register link tags in the HTML header for prev, next, first and last page. Defaults to false to avoid conflicts when multiple pagers are used on one page.

Public Methods

Method Description
init ( ) Initializes the pager.
run ( ) Executes the widget.

Protected Methods

Method Description
getPageRange ( ) : array
registerLinkTags ( ) Registers relational link tags in the html header for prev, next, first and last page.
renderPageButton ( string $label, integer $page, string $class, boolean $disabled, boolean $active ) : string Renders a page button.
renderPageButtons ( ) : string Renders the page buttons.

Method Details

getPageRange() protected method

protected getPageRange ( ) : array
return array the begin and end pages that need to be displayed.

init() public method

Initializes the pager.
public init ( )

registerLinkTags() protected method

These links are generated using [[\yii\data\Pagination::getLinks()]].
See also: http://www.w3.org/TR/html401/struct/links.html#h-12.1.2
protected registerLinkTags ( )

renderPageButton() protected method

You may override this method to customize the generation of page buttons.
protected renderPageButton ( string $label, integer $page, string $class, boolean $disabled, boolean $active ) : string
$label string the text label for the button
$page integer the page number
$class string the CSS class for the page button.
$disabled boolean whether this page button is disabled
$active boolean whether this page button is active
return string the rendering result

renderPageButtons() protected method

Renders the page buttons.
protected renderPageButtons ( ) : string
return string the rendering result

run() public method

This overrides the parent implementation by displaying the generated page buttons.
public run ( )

Property Details

$activePageCssClass public_oe property

the CSS class for the active (currently selected) page button.
public $activePageCssClass

$disabledListItemSubTagOptions public_oe property

the options for the disabled tag to be generated inside the disabled list element. In order to customize the html tag, please use the tag key. php $disabledListItemSubTagOptions = ['tag' => 'div', 'class' => 'disabled-div'];
Since: 2.0.11
public $disabledListItemSubTagOptions

$disabledPageCssClass public_oe property

the CSS class for the disabled page buttons.
public $disabledPageCssClass

$firstPageCssClass public_oe property

the CSS class for the "first" page button.
public $firstPageCssClass

$firstPageLabel public_oe property

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

$hideOnSinglePage public_oe property

Hide widget when only one page exist.
public $hideOnSinglePage

$lastPageCssClass public_oe property

the CSS class for the "last" page button.
public $lastPageCssClass

$lastPageLabel public_oe property

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

$linkOptions public_oe property

HTML attributes for the link in a pager container tag.
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $linkOptions

$maxButtonCount public_oe property

maximum number of page buttons that can be displayed. Defaults to 10.
public $maxButtonCount

$nextPageCssClass public_oe property

the CSS class for the "next" page button.
public $nextPageCssClass

$nextPageLabel public_oe property

the label for the "next" page button. Note that this will NOT be HTML-encoded. If this property is false, the "next" page button will not be displayed.
public $nextPageLabel

$options public_oe property

HTML attributes for the pager container tag.
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $options

$pageCssClass public_oe property

the CSS class for the each page button.
Since: 2.0.7
public $pageCssClass

$pagination public_oe property

the pagination object that this pager is associated with. You must set this property in order to make LinkPager work.
public $pagination

$prevPageCssClass public_oe property

the CSS class for the "previous" page button.
public $prevPageCssClass

$prevPageLabel public_oe property

the text label for the previous page button. Note that this will NOT be HTML-encoded. If this property is false, the "previous" page button will not be displayed.
public $prevPageLabel

$registerLinkTags public_oe property

whether to register link tags in the HTML header for prev, next, first and last page. Defaults to false to avoid conflicts when multiple pagers are used on one page.
See also: http://www.w3.org/TR/html401/struct/links.html#h-12.1.2
See also: registerLinkTags()
public $registerLinkTags