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 Aug 27, 2024
1 parent 0f7de37 commit 8f73f61
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 @@ -248,7 +248,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 @@ -266,12 +266,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 8f73f61

Please sign in to comment.