Upgrade to 4.4.0

This commit is contained in:
Bastian Allgeier
2024-09-12 14:43:02 +02:00
parent a955c7822e
commit 8bc7250b68
87 changed files with 637 additions and 352 deletions

View File

@@ -3,12 +3,14 @@
use Kirby\Toolkit\I18n;
return function ($kirby) {
$blueprint = $kirby->site()->blueprint();
return [
'breadcrumbLabel' => function () use ($kirby) {
return $kirby->site()->title()->or(I18n::translate('view.site'))->toString();
},
'icon' => 'home',
'label' => $kirby->site()->blueprint()->title() ?? I18n::translate('view.site'),
'icon' => $blueprint->icon() ?? 'home',
'label' => $blueprint->title() ?? I18n::translate('view.site'),
'menu' => true,
'dialogs' => require __DIR__ . '/site/dialogs.php',
'drawers' => require __DIR__ . '/site/drawers.php',

View File

@@ -194,12 +194,23 @@ return [
'page.changeTitle' => [
'pattern' => 'pages/(:any)/changeTitle',
'load' => function (string $id) {
$request = App::instance()->request();
$kirby = App::instance();
$request = $kirby->request();
$page = Find::page($id);
$permissions = $page->permissions();
$select = $request->get('select', 'title');
// build the path prefix
$path = match ($kirby->multilang()) {
true => Str::after($kirby->site()->url(), $kirby->url()) . '/',
false => '/'
};
if ($parent = $page->parent()) {
$path .= $parent->uri() . '/';
}
return [
'component' => 'k-form-dialog',
'props' => [
@@ -212,7 +223,7 @@ return [
'slug' => Field::slug([
'required' => true,
'preselect' => $select === 'slug',
'path' => $page->parent() ? '/' . $page->parent()->uri() . '/' : '/',
'path' => $path,
'disabled' => $permissions->can('changeSlug') === false,
'wizard' => [
'text' => I18n::translate('page.changeSlug.fromTitle'),

View File

@@ -5,6 +5,8 @@ use Kirby\Cms\Find;
use Kirby\Toolkit\I18n;
return [
// @codeCoverageIgnoreStart
// TODO: move to controller class and add unit tests
'tree' => [
'pattern' => 'site/tree',
'action' => function () {
@@ -62,5 +64,20 @@ return [
return $pages;
}
],
'tree.parents' => [
'pattern' => 'site/tree/parents',
'action' => function () {
$kirby = App::instance();
$request = $kirby->request();
$page = $kirby->page($request->get('page'));
return [
'data' => $page->parents()->flip()->values(
fn ($parent) => $parent->uuid()?->toString() ?? $parent->id()
)
];
}
]
// @codeCoverageIgnoreEnd
];