Skip to content

Commit ab07e94

Browse files
committed
Update first and last option position regarding prev and next and ellipsis.
1 parent c82194a commit ab07e94

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/View/Helper/BootstrapPaginatorHelper.php

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

@@ -146,21 +145,28 @@ public function numbers (array $options = []) {
146145

147146
/* Custom First and Last. */
148147

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

154150
if ($options['last']) {
151+
$ellipsis = isset($options['ellipsis']) ?
152+
$options['ellipsis'] : is_int($options['last']);
153+
$ellipsis = $ellipsis ? $templater->format('ellipsis', []) : '';
155154
$last = $this->_lastNumber($ellipsis, $params, $end, $options);
156155
}
157156

158-
if ($options['last']) {
157+
if ($options['first']) {
158+
$ellipsis = isset($options['ellipsis']) ?
159+
$options['ellipsis'] : is_int($options['first']);
160+
$ellipsis = $ellipsis ? $templater->format('ellipsis', []) : '';
159161
$first = $this->_firstNumber($ellipsis, $params, $start, $options);
160162
}
161163

162-
$options['before'] = $options['before'].$first.$prev;
163-
$options['after'] = $next.$last.$options['after'];
164+
unset($options['ellipsis']);
165+
166+
$before = is_int($options['first']) ? $prev.$first : $first.$prev;
167+
$after = is_int($options['last']) ? $last.$next : $next.$last;
168+
$options['before'] = $options['before'].$before;;
169+
$options['after'] = $after.$options['after'];
164170
$options['first'] = $options['last'] = false;
165171

166172
if ($options['modulus'] !== false && $params['pageCount'] > $options['modulus']) {
@@ -173,6 +179,7 @@ public function numbers (array $options = []) {
173179
$templater->pop();
174180
}
175181

182+
176183
return $out;
177184
}
178185

0 commit comments

Comments
 (0)