Skip to content

Commit

Permalink
Merge pull request #6643 from getkirby/fix/6640-page-create-dialog-pa…
Browse files Browse the repository at this point in the history
…ge-model

PageCreateDialog: prevent tmp using actual page
  • Loading branch information
distantnative authored Sep 20, 2024
2 parents 981a2c6 + e078242 commit db506f5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Panel/PageCreateDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ public function load(): array
*/
public function model(): Page
{
// TODO: use actual in-memory page in v5
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 +268,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 db506f5

Please sign in to comment.