Skip to content

Commit

Permalink
Add has-children field condition
Browse files Browse the repository at this point in the history
  • Loading branch information
heidkaemper committed Jan 17, 2025
1 parent 5fa2e18 commit 698567b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ protected function extractFromFields($entry, $blueprint)

$extraValues = [
'depth' => $entry->page()?->depth(),
'has-children' => $entry->page()?->hasChildren(),
];

return [$values->all(), $fields->meta(), $extraValues];
Expand Down
5 changes: 5 additions & 0 deletions src/Structures/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ public function setChildren(array $children): self
return $this;
}

public function hasChildren()
{
return !! $this->children;
}

public function setPageData(array $data): self
{
$this->data = $data;
Expand Down

0 comments on commit 698567b

Please sign in to comment.