Skip to content

Kirby 5.0.0

$page->hasNextListed()

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

$page->hasNextListed(Kirby\Cms\Pages|null $collection = null): bool

Parameters

Name Type Default
$collection Kirby\Cms\Pagesornull null

Return type

bool

Parent class

Kirby\Cms\Page

Examples

if ($page->hasNextListed()) {
  echo $page->nextListed()->url();
}

With collection as argument

$collection = $page->siblings()->listed()->sortBy('date', 'desc');

if ($page->hasNextListed($collection)) {
  echo $page->nextListed($collection)->url();
}