Upgrade to 4.1.0

This commit is contained in:
Bastian Allgeier
2024-01-30 16:41:06 +01:00
parent 5c44c8fcfd
commit 9345fc1a0b
59 changed files with 678 additions and 274 deletions

View File

@@ -1,5 +1,6 @@
<?php
use Kirby\Cms\ModelWithContent;
use Kirby\Toolkit\I18n;
use Kirby\Toolkit\Str;
@@ -28,7 +29,7 @@ return [
],
'computed' => [
'columns' => function () {
$columns = [];
$columns = [];
if ($this->layout !== 'table') {
return [];
@@ -94,7 +95,27 @@ return [
},
],
'methods' => [
'columnsValues' => function (array $item, $model) {
'columnsWithTypes' => function () {
$columns = $this->columns;
// add the type to the columns for the table layout
if ($this->layout === 'table') {
$blueprint = $this->models->first()?->blueprint();
if ($blueprint === null) {
return $columns;
}
foreach ($columns as $columnName => $column) {
if ($id = $column['id'] ?? null) {
$columns[$columnName]['type'] ??= $blueprint->field($id)['type'] ?? null;
}
}
}
return $columns;
},
'columnsValues' => function (array $item, ModelWithContent $model) {
$item['title'] = [
// override toSafeString() coming from `$item`
// because the table cells don't use v-html