|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Pagination element with Bootstrap 5 styling. |
4 | | - * Fallback when Tools plugin is not available. |
| 3 | + * Standalone pagination element with Bootstrap 5 styling. |
5 | 4 | * |
6 | | - * @var \App\View\AppView $this |
| 5 | + * Sets explicit templates to avoid style leakage from app templates. |
| 6 | + * |
| 7 | + * @var \Cake\View\View $this |
7 | 8 | */ |
8 | 9 |
|
9 | 10 | if (!$this->Paginator->hasPage()) { |
10 | 11 | return; |
11 | 12 | } |
| 13 | + |
| 14 | +// Set Bootstrap 5 templates explicitly to avoid app template leakage |
| 15 | +$this->Paginator->setTemplates([ |
| 16 | + 'nextActive' => '<li class="page-item"><a class="page-link" rel="next" href="{{url}}">{{text}}</a></li>', |
| 17 | + 'nextDisabled' => '<li class="page-item disabled"><span class="page-link">{{text}}</span></li>', |
| 18 | + 'prevActive' => '<li class="page-item"><a class="page-link" rel="prev" href="{{url}}">{{text}}</a></li>', |
| 19 | + 'prevDisabled' => '<li class="page-item disabled"><span class="page-link">{{text}}</span></li>', |
| 20 | + 'first' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', |
| 21 | + 'last' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', |
| 22 | + 'number' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', |
| 23 | + 'current' => '<li class="page-item active"><span class="page-link">{{text}}</span></li>', |
| 24 | +]); |
12 | 25 | ?> |
13 | | -<nav aria-label="Page navigation"> |
14 | | - <ul class="pagination justify-content-center"> |
15 | | - <?= $this->Paginator->first('«', ['class' => 'page-link']) ?> |
16 | | - <?= $this->Paginator->prev('‹', ['class' => 'page-link']) ?> |
17 | | - <?= $this->Paginator->numbers(['class' => 'page-link']) ?> |
18 | | - <?= $this->Paginator->next('›', ['class' => 'page-link']) ?> |
19 | | - <?= $this->Paginator->last('»', ['class' => 'page-link']) ?> |
| 26 | +<nav class="mt-3" aria-label="<?= __d('queue', 'Page navigation') ?>"> |
| 27 | + <ul class="pagination justify-content-center mb-2"> |
| 28 | + <?= $this->Paginator->first('<i class="fas fa-angle-double-left"></i>', ['escape' => false]) ?> |
| 29 | + <?= $this->Paginator->prev('<i class="fas fa-angle-left"></i>', ['escape' => false]) ?> |
| 30 | + <?= $this->Paginator->numbers() ?> |
| 31 | + <?= $this->Paginator->next('<i class="fas fa-angle-right"></i>', ['escape' => false]) ?> |
| 32 | + <?= $this->Paginator->last('<i class="fas fa-angle-double-right"></i>', ['escape' => false]) ?> |
20 | 33 | </ul> |
| 34 | + <p class="text-center text-muted small mb-0"> |
| 35 | + <?= $this->Paginator->counter(__d('queue', 'Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?> |
| 36 | + </p> |
21 | 37 | </nav> |
22 | | -<p class="text-center text-muted small"> |
23 | | - <?= $this->Paginator->counter(__d('queue', 'Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?> |
24 | | -</p> |
|
0 commit comments