From 11fbc6e38a83879a52365820c17db9f91abfe5e8 Mon Sep 17 00:00:00 2001 From: Nico Hoffmann Date: Mon, 14 Oct 2024 16:59:10 +0700 Subject: [PATCH] Fix `$file::changeTemplate()` --- src/Cms/File.php | 2 +- src/Cms/FileActions.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Cms/File.php b/src/Cms/File.php index b91f6ee1c1..d508d03d38 100644 --- a/src/Cms/File.php +++ b/src/Cms/File.php @@ -584,7 +584,7 @@ public function site(): Site */ public function template(): string|null { - return $this->template ??= $this->content()->get('template')->value(); + return $this->template ??= $this->content('default')->get('template')->value(); } /** diff --git a/src/Cms/FileActions.php b/src/Cms/FileActions.php index 712291a6df..536f3c038a 100644 --- a/src/Cms/FileActions.php +++ b/src/Cms/FileActions.php @@ -137,7 +137,10 @@ public function changeTemplate(string|null $template): static $template = null; } - $file = $file->update(['template' => $template]); + $file = $file->update( + ['template' => $template], + 'default' + ); // resize the file if configured by new blueprint $create = $file->blueprint()->create();