Update to Kirby 4.7.0

This commit is contained in:
Paul Nicoué 2025-04-21 18:57:21 +02:00
parent 02a9ab387c
commit ba25a9a198
509 changed files with 26604 additions and 14872 deletions

View file

@ -23,7 +23,7 @@ class PageUuid extends ModelUuid
/**
* @var \Kirby\Cms\Page|null
*/
public Identifiable|null $model;
public Identifiable|null $model = null;
/**
* Looks up UUID in cache and resolves
@ -31,9 +31,13 @@ class PageUuid extends ModelUuid
*/
protected function findByCache(): Page|null
{
$key = $this->key();
$value = Uuids::cache()->get($key);
return App::instance()->page($value);
if ($key = $this->key()) {
if ($value = Uuids::cache()->get($key)) {
return App::instance()->page($value);
}
}
return null;
}
/**
@ -50,4 +54,25 @@ class PageUuid extends ModelUuid
yield from static::index($page);
}
}
/**
* Returns permalink url
*/
public function url(): string
{
// make sure UUID is cached because the permalink
// route only looks up UUIDs from cache
if ($this->isCached() === false) {
$this->populate();
}
$kirby = App::instance();
$url = $kirby->url();
if ($language = $kirby->language('current')) {
$url .= '/' . $language->code();
}
return $url . '/@/' . static::TYPE . '/' . $this->id();
}
}