Update Kirby and dependencies

This commit is contained in:
Paul Nicoué 2022-08-31 16:08:03 +02:00
parent 07150a0011
commit c7c5d615a4
451 changed files with 67540 additions and 63740 deletions

View file

@ -0,0 +1,62 @@
<?php
use Kirby\Toolkit\I18n;
return [
'mixins' => [
'headline',
],
'props' => [
/**
* Array or query string for reports. Each report needs a `label` and `value` and can have additional `info`, `link` and `theme` settings.
*/
'reports' => function ($reports = null) {
if ($reports === null) {
return [];
}
if (is_string($reports) === true) {
$reports = $this->model()->query($reports);
}
if (is_array($reports) === false) {
return [];
}
return $reports;
},
/**
* The size of the report cards. Available sizes: `tiny`, `small`, `medium`, `large`
*/
'size' => function (string $size = 'large') {
return $size;
}
],
'computed' => [
'reports' => function () {
$reports = [];
$model = $this->model();
$value = fn ($value) => $value === null ? null : $model->toString($value);
foreach ($this->reports as $report) {
if (is_string($report) === true) {
$report = $model->query($report);
}
if (is_array($report) === false) {
continue;
}
$reports[] = [
'label' => I18n::translate($report['label'], $report['label']),
'value' => $value($report['value'] ?? null),
'info' => $value($report['info'] ?? null),
'link' => $value($report['link'] ?? null),
'theme' => $value($report['theme'] ?? null)
];
}
return $reports;
}
]
];