Upgrade to 4.4.0

This commit is contained in:
Bastian Allgeier
2024-09-12 14:43:02 +02:00
parent a955c7822e
commit 8bc7250b68
87 changed files with 637 additions and 352 deletions

View File

@@ -21,6 +21,14 @@ return [
$layouts = ['list', 'cardlets', 'cards', 'table'];
return in_array($layout, $layouts) ? $layout : 'list';
},
/**
* Whether the raw content file values should be used for the table column previews. Should not be used unless it eases performance issues in your setup introduced with Kirby 4.2
*
* @todo remove when Form classes have been refactored
*/
'rawvalues' => function (bool $rawvalues = false) {
return $rawvalues;
},
/**
* The size option controls the size of cards. By default cards are auto-sized and the cards grid will always fill the full width. With a size you can disable auto-sizing. Available sizes: `tiny`, `small`, `medium`, `large`, `huge`, `full`
*/
@@ -133,6 +141,24 @@ return [
$item['info'] = $model->toString($this->info);
}
// if forcing raw values, get those directly from content file
// TODO: remove once Form classes have been refactored
// @codeCoverageIgnoreStart
if ($this->rawvalues === true) {
foreach ($this->columns as $columnName => $column) {
$item[$columnName] = match (empty($column['value'])) {
// if column value defined, resolve the query
false => $model->toString($column['value']),
// otherwise use the form value,
// but don't overwrite columns
default => $item[$columnName] ?? $model->content()->get($column['id'] ?? $columnName)->value()
};
}
return $item;
}
// @codeCoverageIgnoreEnd
// Use form to get the proper values for the columns
$form = Form::for($model)->values();
@@ -142,10 +168,7 @@ return [
false => $model->toString($column['value']),
// otherwise use the form value,
// but don't overwrite columns
default =>
$item[$columnName] ??
$form[$column['id'] ?? $columnName] ??
null,
default => $item[$columnName] ?? $form[$column['id'] ?? $columnName] ?? null
};
}