Skip to content

Commit

Permalink
Accept Array Data
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed Dec 17, 2023
1 parent 8e1b1c1 commit 186f971
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion about.page
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ icon: 'M19 2L14 6.5V17.5L19 13V2M6.5 5C4.55 5 2.45 5.4 1 6.5V21.16C1 21.41 1.25
color: '#75522f'
author: Taufik Nurrohman
type: Markdown
version: 3.1.0
version: 3.1.1
...

This extension uses the structure of the page file location in the `.\lot\page` folder to enable the basic functions of
Expand Down
14 changes: 8 additions & 6 deletions engine/kernel/pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public function __construct(iterable $value = [], string $join = ', ') {
$out[$k] = $v->path;
} else if ($v && is_string($v) && is_file($v)) {
$out[$k] = $v;
} else if (is_array($v)) {
$out[$k] = $v;
}
}
unset($value);
Expand Down Expand Up @@ -66,7 +68,7 @@ public function current($take = false) {
}
return $this->page(null, [
'current' => true,
'description' => i('You are here.'),
'description' => i('You are here'),
'link' => $this->to($part + 1),
'part' => $part + 1,
'title' => i('Current')
Expand All @@ -80,7 +82,7 @@ public function data(): Traversable {
for ($i = 0; $i < $last; ++$i) {
yield $i => $this->page(null, [
'current' => $i === $part,
'description' => i('Go to page %d.', $i + 1),
'description' => i('Go to page %d', $i + 1),
'link' => $this->to($i + 1),
'part' => $i + 1,
'title' => i('Page %d', $i + 1)
Expand All @@ -105,7 +107,7 @@ public function first($take = false) {
}
return $this->page(null, [
'current' => ($first = 1) === $part + 1,
'description' => i('Go to the %s page.', 'first'),
'description' => i('Go to the %s page', 'first'),
'link' => $this->to($first),
'part' => $first,
'title' => i('First')
Expand All @@ -126,7 +128,7 @@ public function last($take = false) {
}
return $this->page(null, [
'current' => ($last = ceil(count($lot) / $chunk)) === $part + 1,
'description' => i('Go to the %s page.', 'last'),
'description' => i('Go to the %s page', 'last'),
'link' => $this->to($last),
'part' => $last,
'title' => i('Last')
Expand Down Expand Up @@ -155,7 +157,7 @@ public function next($take = false) {
}
return $this->page(null, [
'current' => false,
'description' => i('Go to the %s page.', 'next'),
'description' => i('Go to the %s page', 'next'),
'link' => $this->to($part + 2),
'part' => $part + 2,
'title' => i('Next')
Expand All @@ -176,7 +178,7 @@ public function prev($take = false) {
}
return $this->page(null, [
'current' => false,
'description' => i('Go to the %s page.', 'previous'),
'description' => i('Go to the %s page', 'previous'),
'link' => $this->to($part),
'part' => $part,
'title' => i('Previous')
Expand Down

0 comments on commit 186f971

Please sign in to comment.