mat.twg писал(а): ↑2017.02.15, 03:58
Где наследовал? Почему я вижу в исходном посте
\yii\widgets\LinkPager::widget ? У вас должен быть свой виджет, основанный на
LinkPager, а там меняйте всё что угодно и как угодно - откройте класс и посмотрите.
Код: Выделить всё
class DivPager extends LinkPager
{
protected function renderPageButtons()
{
$pageCount = $this->pagination->getPageCount();
if ($pageCount < 2 && $this->hideOnSinglePage) {
return '';
}
$buttons = [];
$currentPage = $this->pagination->getPage();
// first page
$firstPageLabel = $this->firstPageLabel === true ? '1' : $this->firstPageLabel;
if ($firstPageLabel !== false) {
$buttons[] = $this->renderPageButton($firstPageLabel, 0, $this->firstPageCssClass, $currentPage <= 0, false);
}
// prev page
if ($this->prevPageLabel !== false) {
if (($page = $currentPage - 1) < 0) {
$page = 0;
}
$buttons[] = $this->renderPageButton($this->prevPageLabel, $page, $this->prevPageCssClass, $currentPage <= 0, false);
}
// internal pages
list($beginPage, $endPage) = $this->getPageRange();
for ($i = $beginPage; $i <= $endPage; ++$i) {
$buttons[] = $this->renderPageButton($i + 1, $i, null, false, $i == $currentPage);
}
// next page
if ($this->nextPageLabel !== false) {
if (($page = $currentPage + 1) >= $pageCount - 1) {
$page = $pageCount - 1;
}
$buttons[] = $this->renderPageButton($this->nextPageLabel, $page, $this->nextPageCssClass, $currentPage >= $pageCount - 1, false);
}
// last page
$lastPageLabel = $this->lastPageLabel === true ? $pageCount : $this->lastPageLabel;
if ($lastPageLabel !== false) {
$buttons[] = $this->renderPageButton($lastPageLabel, $pageCount - 1, $this->lastPageCssClass, $currentPage >= $pageCount - 1, false);
}
return Html::tag('div', implode("\n", $buttons), $this->options);
}
protected function renderPageButton($label, $page, $class, $disabled, $active)
{
$options = ['class' => empty($class) ? $this->pageCssClass : $class];
if ($active) {
Html::addCssClass($options, $this->activePageCssClass);
}
if ($disabled) {
Html::addCssClass($options, $this->disabledPageCssClass);
$tag = ArrayHelper::remove($this->disabledListItemSubTagOptions, 'tag', 'span');
return Html::tag('li', Html::tag($tag, $label, $this->disabledListItemSubTagOptions), $options);
}
$linkOptions = $this->linkOptions;
$linkOptions['data-page'] = $page;
return Html::a($label, $this->pagination->createUrl($page), $linkOptions);
}
}
Код: Выделить всё
echo \app\components\DivPager::widget([
'pagination' => $pages,
'options' => [
'class' => 'filter_nav',
],
'maxButtonCount'=>1,
'prevPageLabel'=>'‹',
'nextPageLabel'=>'›',
'prevPageCssClass' => 'prev_s',
'nextPageCssClass' => 'next_s',
'maxButtonCount' => 1,
]);?>
Проблема не в div или ul...