Upgrade to 4.1.0
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user