Reference

Guide

$page->hasNextListed()

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

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

Parameters

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

Return type

bool

Example

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

With collection as argument

<?php
$collection = $page->siblings()->listed()->sortBy('date', 'desc');
if ($page->hasNextListed($collection)) {
  echo $page->nextListed($collection)->url();
}
?>

Source code

kirby/src/Cms/PageSiblings.php#L24