diff --git a/resources/js/components/structures/PageEditor.vue b/resources/js/components/structures/PageEditor.vue index 496b90a59a..5e1bf3832c 100644 --- a/resources/js/components/structures/PageEditor.vue +++ b/resources/js/components/structures/PageEditor.vue @@ -25,6 +25,7 @@ :name="publishContainer" :blueprint="adjustedBlueprint" :values="values" + :extra-values="extraValues" :meta="meta" :errors="errors" :localized-fields="localizedFields" @@ -94,6 +95,7 @@ export default { meta: null, originValues: null, originMeta: null, + extraValues: null, localizedFields: null, syncableFields: null, loading: true, @@ -275,6 +277,7 @@ export default { this.originValues = info.originValues; this.meta = info.meta; this.originMeta = info.originMeta; + this.extraValues = info.extraValues; this.localizedFields = info.localizedFields; this.syncableFields = info.syncableFields; }, @@ -285,6 +288,7 @@ export default { originValues: this.originValues, meta: this.meta, originMeta: this.originMeta, + extraValues: this.extraValues, localizedFields: this.localizedFields, syncableFields: this.syncableFields, entry: this.entry, diff --git a/src/Http/Controllers/CP/Navigation/NavigationPagesController.php b/src/Http/Controllers/CP/Navigation/NavigationPagesController.php index 7430a9807d..614544229d 100644 --- a/src/Http/Controllers/CP/Navigation/NavigationPagesController.php +++ b/src/Http/Controllers/CP/Navigation/NavigationPagesController.php @@ -52,7 +52,7 @@ public function edit(Request $request, $nav, $page) $page = $nav->in($request->site)->find($page); - [$values, $meta] = $this->extractValuesAndMeta($page, $blueprint); + [$values, $meta, $extraValues] = $this->extractValuesAndMeta($page, $blueprint); if ($entry = $page->entry()) { [$originValues, $originMeta] = $this->extractValuesAndMeta($entry, $blueprint); @@ -63,6 +63,7 @@ public function edit(Request $request, $nav, $page) 'meta' => $meta, 'originValues' => $originValues ?? null, 'originMeta' => $originMeta ?? null, + 'extraValues' => $extraValues, 'localizedFields' => $this->getLocalizedFields($page), 'syncableFields' => $this->getSyncableFields($nav, $entry), ]; @@ -113,7 +114,11 @@ private function extractValuesAndMeta($page, $blueprint) $values = $fields->values(); - return [$values->all(), $fields->meta()]; + $extraValues = [ + 'depth' => $page instanceof Page ? $page->depth() : null, + ]; + + return [$values->all(), $fields->meta(), $extraValues]; } private function getPageValues($page)