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

@ -2,7 +2,6 @@
namespace Kirby\Field;
use Kirby\Blueprint\Node;
use Kirby\Cms\ModelWithContent;
use Kirby\Option\Options;
use Kirby\Option\OptionsApi;
@ -18,14 +17,14 @@ use Kirby\Option\OptionsQuery;
* @copyright Bastian Allgeier
* @license https://opensource.org/licenses/MIT
*/
class FieldOptions extends Node
class FieldOptions
{
public function __construct(
/**
* The option source, either a fixed collection or
* a dynamic provider
*/
public Options|OptionsProvider|null $options = null,
public Options|OptionsProvider $options = new Options(),
/**
* Whether to escape special HTML characters in
@ -36,13 +35,6 @@ class FieldOptions extends Node
) {
}
public function defaults(): static
{
$this->options ??= new Options();
return parent::defaults();
}
public static function factory(array $props, bool $safeMode = true): static
{
$options = match ($props['type']) {
@ -67,7 +59,7 @@ class FieldOptions extends Node
OptionsQuery::polyfill($props['query'] ?? null),
default =>
[ 'type' => 'query', 'query' => $props['options']]
['type' => 'query', 'query' => $props['options']]
};
}
@ -87,22 +79,18 @@ class FieldOptions extends Node
return $props;
}
public function resolve(ModelWithContent $model): Options
{
// apply default values
$this->defaults();
// already Options, return
if (is_a($this->options, Options::class) === true) {
return $this->options;
}
// resolve OptionsProvider (OptionsApi or OptionsQuery) to Options
return $this->options = $this->options->resolve($model, $this->safeMode);
}
public function render(ModelWithContent $model): array
{
return $this->resolve($model)->render($model);
}
public function resolve(ModelWithContent $model): Options
{
// resolve OptionsProvider (OptionsApi or OptionsQuery) to Options
if ($this->options instanceof OptionsProvider) {
return $this->options->resolve($model, $this->safeMode);
}
return $this->options;
}
}