update kirby to v5 and add refresh cache panel view button

This commit is contained in:
isUnknown 2025-09-10 14:28:38 +02:00
commit 9a86d41254
466 changed files with 19960 additions and 10497 deletions

View file

@ -3,6 +3,7 @@
namespace Kirby\Template;
use Kirby\Exception\LogicException;
use Stringable;
/**
* The slot class catches all content
@ -16,11 +17,10 @@ use Kirby\Exception\LogicException;
* @copyright Bastian Allgeier
* @license https://getkirby.com/license
*/
class Slot
class Slot implements Stringable
{
/**
* The captured slot content
* @internal
*/
public string|null $content;
@ -69,7 +69,7 @@ class Slot
public function close(): void
{
if ($this->open === false) {
throw new LogicException('The slot has not been opened');
throw new LogicException(message: 'The slot has not been opened');
}
$this->content = ob_get_clean();

View file

@ -5,6 +5,7 @@ namespace Kirby\Template;
use Kirby\Cms\App;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Exception\LogicException;
use Kirby\Filesystem\F;
use Kirby\Toolkit\A;
use Kirby\Toolkit\Tpl;
@ -27,7 +28,6 @@ class Snippet extends Tpl
* snippet. This is used to start
* and end slots within this snippet
* in the helper functions
* @internal
*/
public static self|null $current = null;
@ -101,12 +101,14 @@ class Snippet extends Tpl
// is only supported if the snippet has
// been started before
if ($this->open === false) {
throw new LogicException('The snippet has not been opened');
throw new LogicException(
message: 'The snippet has not been opened'
);
}
// create a default slot for the content
// that has been captured between start and end
if (empty($this->slots) === true) {
if ($this->slots === []) {
$this->slots['default'] = new Slot('default');
$this->slots['default']->content = ob_get_clean();
} else {
@ -187,7 +189,7 @@ class Snippet extends Tpl
$name = (string)$name;
$file = $root . '/' . $name . '.php';
if (file_exists($file) === false) {
if (F::exists($file, $root) === false) {
$file = $kirby->extensions('snippets')[$name] ?? null;
}
@ -290,19 +292,21 @@ class Snippet extends Tpl
): array {
// initialize a dummy slots object and cache it for better performance
$slots ??= static::$dummySlots ??= new Slots([]);
$data = array_merge(App::instance()->data, $data);
$data = [...App::instance()->data, ...$data];
if (
array_key_exists('slot', $data) === true ||
array_key_exists('slots', $data) === true
) {
throw new InvalidArgumentException('Passing the $slot or $slots variables to snippets is not supported.');
throw new InvalidArgumentException(
message: 'Passing the $slot or $slots variables to snippets is not supported.'
);
}
return array_merge($data, [
return [
...$data,
'slot' => $slots->default,
'slots' => $slots,
]);
];
}
}

View file

@ -6,6 +6,7 @@ use Exception;
use Kirby\Cms\App;
use Kirby\Filesystem\F;
use Kirby\Toolkit\Tpl;
use Stringable;
/**
* Represents a Kirby template and takes care
@ -17,7 +18,7 @@ use Kirby\Toolkit\Tpl;
* @copyright Bastian Allgeier
* @license https://getkirby.com/license
*/
class Template
class Template implements Stringable
{
/**
* Global template data