Skip to content

Commit

Permalink
PageCreateDialog: prevent tmp using actual page
Browse files Browse the repository at this point in the history
Fixes #6640
  • Loading branch information
distantnative committed Sep 20, 2024
1 parent 981a2c6 commit 185e85c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Panel/PageCreateDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public function load(): array
public function model(): Page
{
return $this->model ??= Page::factory([
'slug' => 'new',
'slug' => '__new__',
'template' => $this->template,
'model' => $this->template,
'parent' => $this->parent instanceof Page ? $this->parent : null
Expand All @@ -267,12 +267,7 @@ public function resolveFieldTemplates(array $input): array

// create temporary page object
// to resolve the template strings
$page = new Page([
'slug' => 'tmp',
'template' => $this->template,
'parent' => $this->model(),
'content' => $input
]);
$page = $this->model()->clone(['content' => $input]);

if (is_string($title)) {
$input['title'] = $page->toSafeString($title);
Expand Down

0 comments on commit 185e85c

Please # to comment.