Skip to content

Commit

Permalink
Fix $file::changeTemplate()
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed Oct 15, 2024
1 parent dd4660a commit 11fbc6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Cms/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/Cms/FileActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 11fbc6e

Please sign in to comment.