Upgrade to 4.5.0

This commit is contained in:
Bastian Allgeier
2024-11-28 11:24:28 +01:00
parent 49287c7a5e
commit 63ddf40692
86 changed files with 942 additions and 491 deletions

View File

@@ -153,7 +153,7 @@ trait PageActions
string|null $languageCode = null
): static {
// always sanitize the slug
$slug = Str::slug($slug);
$slug = Url::slug($slug);
// in multi-language installations the slug for the non-default
// languages is stored in the text file. The changeSlugForLanguage
@@ -431,6 +431,8 @@ trait PageActions
* Copies the page to a new parent
*
* @throws \Kirby\Exception\DuplicateException If the page already exists
*
* @internal
*/
public function copy(array $options = []): static
{
@@ -443,7 +445,7 @@ trait PageActions
$files = $options['files'] ?? false;
// clean up the slug
$slug = Str::slug($slug);
$slug = Url::slug($slug);
if ($parentModel->findPageOrDraft($slug)) {
throw new DuplicateException([
@@ -495,7 +497,7 @@ trait PageActions
public static function create(array $props): Page
{
// clean up the slug
$props['slug'] = Str::slug($props['slug'] ?? $props['content']['title'] ?? null);
$props['slug'] = Url::slug($props['slug'] ?? $props['content']['title'] ?? null);
$props['template'] = $props['model'] = strtolower($props['template'] ?? 'default');
$props['isDraft'] ??= $props['draft'] ?? true;
@@ -685,7 +687,7 @@ trait PageActions
public function duplicate(string|null $slug = null, array $options = []): static
{
// create the slug for the duplicate
$slug = Str::slug($slug ?? $this->slug() . '-' . Str::slug(I18n::translate('page.duplicate.appendix')));
$slug = Url::slug($slug ?? $this->slug() . '-' . Url::slug(I18n::translate('page.duplicate.appendix')));
$arguments = [
'originalPage' => $this,
@@ -762,6 +764,7 @@ trait PageActions
/**
* @return $this|static
* @throws \Kirby\Exception\LogicException If the folder cannot be moved
* @internal
*/
public function publish(): static
{
@@ -913,6 +916,7 @@ trait PageActions
/**
* Convert a page from listed or
* unlisted to draft.
* @internal
*
* @return $this|static
* @throws \Kirby\Exception\LogicException If the folder cannot be moved