Skip to content

Commit 51bb76c

Browse files
author
Mikaël Capelle
committed
Add easyIcon for last and prev. Add option to remove ellipsis.
1 parent 3eefbb4 commit 51bb76c

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/View/Helper/BootstrapPaginatorHelper.php

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ public function numbers (array $options = []) {
8383
$defaults = [
8484
'before' => null, 'after' => null, 'model' => $this->defaultModel(),
8585
'modulus' => 8, 'first' => null, 'last' => null, 'url' => [],
86-
'class' => '', 'size' => false
86+
'prev' => null, 'next' => null,
87+
'ellipsis' => true, 'class' => '', 'size' => false
8788
];
8889
$options += $defaults;
8990

@@ -119,7 +120,7 @@ public function numbers (array $options = []) {
119120

120121
/* Previous and Next buttons (addition from standard PaginatorHelper). */
121122

122-
if (isset($options['prev'])) {
123+
if ($options['prev']) {
123124
$title = $options['prev'] ;
124125
$opts = [] ;
125126
if (is_array($title)) {
@@ -128,10 +129,10 @@ public function numbers (array $options = []) {
128129
$opts = $options['prev'] ;
129130
}
130131
$prev = $this->prev($title, $opts) ;
131-
unset($options['prev']);
132132
}
133+
unset($options['prev']);
133134

134-
if (isset($options['next'])) {
135+
if ($options['next']) {
135136
$title = $options['next'] ;
136137
$opts = [] ;
137138
if (is_array($title)) {
@@ -140,19 +141,21 @@ public function numbers (array $options = []) {
140141
$opts = $options['next'];
141142
}
142143
$next = $this->next($title, $opts);
143-
unset($options['next']);
144144
}
145+
unset($options['next']);
145146

146147
/* Custom First and Last. */
147148

148-
$ellipsis = $templater->format('ellipsis', []);
149+
$ellipsis = $options['ellipsis'];
150+
unset($options['ellipsis']);
151+
$ellipsis = $ellipsis ? $templater->format('ellipsis', []) : "";
149152
list($start, $end) = $this->_getNumbersStartAndEnd($params, $options);
150153

151-
if (isset($options['last'])) {
154+
if ($options['last']) {
152155
$last = $this->_lastNumber($ellipsis, $params, $end, $options);
153156
}
154157

155-
if (isset($options['last'])) {
158+
if ($options['last']) {
156159
$first = $this->_firstNumber($ellipsis, $params, $start, $options);
157160
}
158161

@@ -174,13 +177,20 @@ public function numbers (array $options = []) {
174177
}
175178

176179
public function prev ($title = '<< Previous', array $options = []) {
177-
return $this->_easyIcon ('parent::prev', $title, $options);
180+
return $this->_easyIcon('parent::prev', $title, $options);
178181
}
179182

180183
public function next ($title = 'Next >>', array $options = []) {
181-
return $this->_easyIcon ('parent::next', $title, $options);
184+
return $this->_easyIcon('parent::next', $title, $options);
185+
}
186+
/*
187+
public function first($first = '<< first', array $options = []) {
188+
return $this->_easyIcon('parent::first', first, $options);
182189
}
183190
191+
public function last($last = 'last >>', array $options = []) {
192+
return $this->_easyIcon('parent::last', $last, $options);
193+
}*/
184194

185195
}
186196

0 commit comments

Comments
 (0)