Update to Kirby 4.7.0
This commit is contained in:
parent
02a9ab387c
commit
ba25a9a198
509 changed files with 26604 additions and 14872 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue