Update to Kirby 5

This commit is contained in:
Paul Nicoué 2025-07-11 14:41:34 +02:00
parent 5d9979fca8
commit 0fefc5e2e1
472 changed files with 30853 additions and 10301 deletions

View file

@ -0,0 +1,45 @@
<?php
use Kirby\Exception\Exception;
use Kirby\Exception\PermissionException;
use Kirby\Toolkit\I18n;
return [
'props' => [
/**
* Activates the batch delete option for the section
*/
'batch' => function (bool $batch = false) {
return $batch;
},
],
'methods' => [
'deleteSelected' => function (array $ids): bool {
if ($ids === []) {
return true;
}
// check if batch deletion is allowed
if ($this->batch() === false) {
throw new PermissionException(
message: 'The section does not support batch actions'
);
}
$min = $this->min();
// check if the section has enough items after the deletion
if ($this->total() - count($ids) < $min) {
throw new Exception(
message: I18n::template('error.section.' . $this->type() . '.min.' . I18n::form($min), [
'min' => $min,
'section' => $this->headline()
])
);
}
$this->models()->delete($ids);
return true;
}
]
];

View file

@ -19,7 +19,7 @@ return [
*/
'layout' => function (string $layout = 'list') {
$layouts = ['list', 'cardlets', 'cards', 'table'];
return in_array($layout, $layouts) ? $layout : 'list';
return in_array($layout, $layouts, true) ? $layout : 'list';
},
/**
* Whether the raw content file values should be used for the table column previews. Should not be used unless it eases performance issues in your setup introduced with Kirby 4.2

View file

@ -24,7 +24,9 @@ return [
$parent = $this->model->query($query);
if (!$parent) {
throw new Exception('The parent for the query "' . $query . '" cannot be found in the section "' . $this->name() . '"');
throw new Exception(
message: 'The parent for the query "' . $query . '" cannot be found in the section "' . $this->name() . '"'
);
}
if (
@ -33,7 +35,9 @@ return [
$parent instanceof File === false &&
$parent instanceof User === false
) {
throw new Exception('The parent for the section "' . $this->name() . '" has to be a page, site or user object');
throw new Exception(
message: 'The parent for the section "' . $this->name() . '" has to be a page, site or user object'
);
}
}

View file

@ -29,7 +29,7 @@ return [
if (
$this->type === 'pages' &&
in_array($this->status, ['listed', 'published', 'all']) === false
in_array($this->status, ['listed', 'published', 'all'], true) === false
) {
return false;
}