Skip to content

Kirby 4.5.0

$page->hasPrevListed()

Checks if there's a previous listed page in the siblings collection

$page->hasPrevListed(\Kirby\Cms\Collection|null $collection = null): bool

Parameters

Name Type Default
$collection Kirby\Cms\Collection|null null

Return type

bool

Parent class

Kirby\Cms\Page

Example

if ($page->hasPrevListed()) {
  echo $page->prevListed()->url();
}

With collection as argument

$collection = $page->siblings()->listed()->sortBy('date', 'desc');
if ($page->hasPrevListed($collection)) {
  echo $page->prevListed($collection)->url();
}