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

@ -31,6 +31,18 @@ return [
];
}
],
[
'pattern' => 'system/method-test',
'method' => 'PATCH',
'action' => function () {
return [
'status' => match ($this->kirby()->request()->method()) {
'PATCH' => 'ok',
default => 'fail'
}
];
}
],
[
'pattern' => 'system/register',
'method' => 'POST',

View file

@ -203,7 +203,9 @@ return [
'users/(:any)/roles',
],
'action' => function (string $id) {
return $this->user($id)->roles();
$kirby = $this->kirby();
$purpose = $kirby->request()->get('purpose');
return $this->user($id)->roles($purpose);
}
],
[

View file

@ -256,7 +256,7 @@ return [
},
'submit' => function (string $languageCode, string $translationKey) {
Find::language($languageCode)->variable($translationKey, true)->update(
App::instance()->request()->get('value')
App::instance()->request()->get('value', '')
);
return true;

View file

@ -3,6 +3,7 @@
use Kirby\Cms\App;
use Kirby\Cms\Find;
use Kirby\Cms\PageRules;
use Kirby\Cms\Url;
use Kirby\Exception\Exception;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Exception\PermissionException;
@ -431,7 +432,7 @@ return [
];
}
$slugAppendix = Str::slug(I18n::translate('page.duplicate.appendix'));
$slugAppendix = Url::slug(I18n::translate('page.duplicate.appendix'));
$titleAppendix = I18n::translate('page.duplicate.appendix');
// if the item to be duplicated already exists

View file

@ -70,12 +70,19 @@ return [
'action' => function () {
$kirby = App::instance();
$request = $kirby->request();
$root = $request->get('root');
$page = $kirby->page($request->get('page'));
$parents = $page?->parents()->flip()->values(
fn ($parent) => $parent->uuid()?->toString() ?? $parent->id()
) ?? [];
// if root is included, add the site as top-level parent
if ($root === 'true') {
array_unshift($parents, $kirby->site()->uuid()?->toString() ?? '/');
}
return [
'data' => $page->parents()->flip()->values(
fn ($parent) => $parent->uuid()?->toString() ?? $parent->id()
)
'data' => $parents
];
}
]

View file

@ -20,12 +20,19 @@ return [
'pattern' => 'users/create',
'load' => function () {
$kirby = App::instance();
$roles = $kirby->roles()->canBeCreated();
// get default value for role
if ($role = $kirby->request()->get('role')) {
$role = $kirby->roles()->find($role)?->id();
$role = $roles->find($role)?->id();
}
// get role field definition, incl. available role options
$roles = Field::role(
roles: $roles,
props: ['required' => true]
);
return [
'component' => 'k-form-dialog',
'props' => [
@ -39,9 +46,7 @@ return [
'translation' => Field::translation([
'required' => true
]),
'role' => Field::role([
'required' => true
])
'role' => $roles
],
'submitButton' => I18n::translate('create'),
'value' => [
@ -49,7 +54,7 @@ return [
'email' => '',
'password' => '',
'translation' => $kirby->panelLanguage(),
'role' => $role ?? $kirby->user()->role()->name()
'role' => $role ?? $roles['options'][0]['value'] ?? null
]
]
];
@ -228,10 +233,13 @@ return [
'component' => 'k-form-dialog',
'props' => [
'fields' => [
'role' => Field::role([
'label' => I18n::translate('user.changeRole.select'),
'required' => true,
])
'role' => Field::role(
roles: $user->roles(),
props: [
'label' => I18n::translate('user.changeRole.select'),
'required' => true,
]
)
],
'submitButton' => I18n::translate('user.changeRole'),
'value' => [

View file

@ -18,7 +18,8 @@ return [
return [
'component' => 'k-users-view',
'props' => [
'role' => function () use ($kirby, $roles, $role) {
'canCreate' => $kirby->roles()->canBeCreated()->count() > 0,
'role' => function () use ($roles, $role) {
if ($role) {
return $roles[$role] ?? null;
}

View file

@ -10,12 +10,13 @@ if (
) {
$url = $video->url();
$attrs = array_filter([
'autoplay' => $block->autoplay()->toBool(),
'controls' => $block->controls()->toBool(),
'loop' => $block->loop()->toBool(),
'muted' => $block->muted()->toBool(),
'poster' => $block->poster()->toFile()?->url(),
'preload' => $block->preload()->value(),
'autoplay' => $block->autoplay()->toBool(),
'controls' => $block->controls()->toBool(),
'loop' => $block->loop()->toBool(),
'muted' => $block->muted()->toBool() || $block->autoplay()->toBool(),
'playsinline' => $block->autoplay()->toBool(),
'poster' => $block->poster()->toFile()?->url(),
'preload' => $block->preload()->value(),
]);
} else {
$url = $block->url();