diff --git a/src/Http/Controllers/CP/Collections/ExtractsFromEntryFields.php b/src/Http/Controllers/CP/Collections/ExtractsFromEntryFields.php index e196ada88a..7a045cb808 100644 --- a/src/Http/Controllers/CP/Collections/ExtractsFromEntryFields.php +++ b/src/Http/Controllers/CP/Collections/ExtractsFromEntryFields.php @@ -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]; diff --git a/src/Structures/Page.php b/src/Structures/Page.php index afb23c50ac..5768aa87d9 100644 --- a/src/Structures/Page.php +++ b/src/Structures/Page.php @@ -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;