Skip to content

Commit 6046ff6

Browse files
committed
Remove constructor and add templates to config attribute.
1 parent aeb9b73 commit 6046ff6

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

src/View/Helper/BootstrapPaginatorHelper.php

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,46 @@
2727
class BootstrapPaginatorHelper extends PaginatorHelper {
2828

2929
use BootstrapTrait ;
30-
31-
public function __construct ($view, $config = []) {
32-
$this->templates([
30+
31+
/**
32+
* Default config for this class
33+
*
34+
* Options: Holds the default options for pagination links
35+
*
36+
* The values that may be specified are:
37+
*
38+
* - `url` Url of the action. See Router::url()
39+
* - `url['sort']` the key that the recordset is sorted.
40+
* - `url['direction']` Direction of the sorting (default: 'asc').
41+
* - `url['page']` Page number to use in links.
42+
* - `model` The name of the model.
43+
* - `escape` Defines if the title field for the link should be escaped (default: true).
44+
*
45+
* Templates: the templates used by this class
46+
*
47+
* @var array
48+
*/
49+
protected $_defaultConfig = [
50+
'options' => [],
51+
'templates' => [
3352
'nextActive' => '<li><a href="{{url}}">{{text}}</a></li>',
3453
'nextDisabled' => '<li class="disabled"><a>{{text}}</a></li>',
3554
'prevActive' => '<li><a href="{{url}}">{{text}}</a></li>',
3655
'prevDisabled' => '<li class="disabled"><a>{{text}}</a></li>',
56+
'counterRange' => '{{start}} - {{end}} of {{count}}',
57+
'counterPages' => '{{page}} of {{pages}}',
3758
'first' => '<li><a href="{{url}}">{{text}}</a></li>',
3859
'last' => '<li><a href="{{url}}">{{text}}</a></li>',
3960
'number' => '<li><a href="{{url}}">{{text}}</a></li>',
40-
'current ' => '<li class="active"><a href="{{url}}">{{text}}</a></li>'
41-
]);
42-
43-
parent::__construct($view, $config);
44-
}
61+
'current' => '<li class="active"><a href="{{url}}">{{text}}</a></li>',
62+
'ellipsis' => '<li class="ellipsis">...</li>',
63+
'sort' => '<a href="{{url}}">{{text}}</a>',
64+
'sortAsc' => '<a class="asc" href="{{url}}">{{text}}</a>',
65+
'sortDesc' => '<a class="desc" href="{{url}}">{{text}}</a>',
66+
'sortAscLocked' => '<a class="asc locked" href="{{url}}">{{text}}</a>',
67+
'sortDescLocked' => '<a class="desc locked" href="{{url}}">{{text}}</a>',
68+
]
69+
];
4570

4671
/**
4772
*

0 commit comments

Comments
 (0)