Reference

Guide

$page->hasNextUnlisted()

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

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

Parameters

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

Return type

bool

Example

if ($page->hasNextUnlisted()) {
  echo $page->nextUnlisted()->url();
}

With collection as argument

$collection = $page->siblings()->unlisted()->sortBy('date', 'desc');
if ($page->hasNextUnlisted($collection)) {
  echo $page->nextUnlisted($collection)->url();
}

Source code

kirby/src/Cms/PageSiblings.php#L37