Skip to content

Kirby 5.1.1

$page->hasChildren()

Checks if the model has any published children

$page->hasChildren(): bool

Return type

bool

This method modifies the existing $page object it is applied to and returns it again.

Parent class

Kirby\Cms\Page

Examples

echo $page->hasChildren(); //will echo 1 if true, nothing if false

if ($page->hasChildren()) {
  $children = $page->children();
}