Commit b7fddd8d by Carsten Brandt

Added LinkPager::$linkOptions

fixes #2367
parent ac3ac5d1
...@@ -33,8 +33,10 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -33,8 +33,10 @@ $this->params['breadcrumbs'][] = $this->title;
<?= "<?= " ?>Html::a('Update', ['update', <?= $urlParams ?>], ['class' => 'btn btn-primary']) ?> <?= "<?= " ?>Html::a('Update', ['update', <?= $urlParams ?>], ['class' => 'btn btn-primary']) ?>
<?= "<?php " ?>echo Html::a('Delete', ['delete', <?= $urlParams ?>], [ <?= "<?php " ?>echo Html::a('Delete', ['delete', <?= $urlParams ?>], [
'class' => 'btn btn-danger', 'class' => 'btn btn-danger',
'data-confirm' => Yii::t('app', 'Are you sure to delete this item?'), 'data' => [
'data-method' => 'post', 'confirm' => Yii::t('app', 'Are you sure to delete this item?'),
'method' => 'post',
],
]); ?> ]); ?>
</p> </p>
......
...@@ -38,6 +38,10 @@ class LinkPager extends Widget ...@@ -38,6 +38,10 @@ class LinkPager extends Widget
*/ */
public $options = ['class' => 'pagination']; public $options = ['class' => 'pagination'];
/** /**
* @var array HTML attributes for the link in a pager container tag.
*/
public $linkOptions = [];
/**
* @var string the CSS class for the "first" page button. * @var string the CSS class for the "first" page button.
*/ */
public $firstPageCssClass = 'first'; public $firstPageCssClass = 'first';
...@@ -172,7 +176,9 @@ class LinkPager extends Widget ...@@ -172,7 +176,9 @@ class LinkPager extends Widget
Html::addCssClass($options, $this->disabledPageCssClass); Html::addCssClass($options, $this->disabledPageCssClass);
return Html::tag('li', Html::tag('span', $label), $options); return Html::tag('li', Html::tag('span', $label), $options);
} }
return Html::tag('li', Html::a($label, $this->pagination->createUrl($page), ['data-page' => $page]), $options); $linkOptions = $this->linkOptions;
$linkOptions['data-page'] = $page;
return Html::tag('li', Html::a($label, $this->pagination->createUrl($page), $linkOptions), $options);
} }
/** /**
......
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