fix #72 - update to Kirby 4.5

This commit is contained in:
isUnknown 2025-01-07 16:59:31 +01:00
parent cb1f842fc9
commit 44d08b3e21
273 changed files with 678 additions and 54176 deletions

View file

@ -3,6 +3,7 @@
namespace Kirby\Uuid;
use Generator;
use Kirby\Cms\App;
use Kirby\Cms\File;
/**
@ -83,4 +84,18 @@ class FileUuid extends ModelUuid
'filename' => $model->filename()
];
}
/**
* 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();
}
return App::instance()->url() . '/@/' . static::TYPE . '/' . $this->id();
}
}

View file

@ -2,8 +2,6 @@
namespace Kirby\Uuid;
use Kirby\Cms\App;
/**
* Base for UUIDs for models where id string
* is stored in the content, such as pages and files
@ -107,18 +105,4 @@ abstract class ModelUuid extends Uuid
// use the most basic write method to avoid object cloning
$this->model->writeContent($data, 'default');
}
/**
* 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();
}
return App::instance()->url() . '/@/' . static::TYPE . '/' . $this->id();
}
}

View file

@ -54,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();
}
}