1
0

downgrade to kirby v3

This commit is contained in:
Philip Wagner
2024-09-01 10:47:15 +02:00
parent a4b2aece7b
commit af86acb7a1
1085 changed files with 54743 additions and 65042 deletions

View File

@@ -1,14 +1,20 @@
<?php
use Kirby\Cms\Helpers;
use Kirby\Toolkit\I18n;
return [
'props' => [
/**
* The headline for the section. This can be a simple string or a template with additional info from the parent page.
* @deprecated 3.8.0 Use `label` instead
* @todo remove in 3.9.0
*/
'headline' => function ($headline = null) {
// TODO: add deprecation notive in 3.8.0
// if ($headline !== null) {
// Helpers::deprecated('`headline` prop for sections has been deprecated and will be removed in Kirby 3.9.0. Use `label` instead.');
// }
return I18n::translate($headline, $headline);
},
/**
@@ -22,14 +28,14 @@ return [
],
'computed' => [
'headline' => function () {
if ($this->label) {
return $this->model()->toString($this->label);
}
if ($this->headline) {
return $this->model()->toString($this->headline);
}
if ($this->label) {
return $this->model()->toString($this->label);
}
return ucfirst($this->name);
}
]

View File

@@ -1,7 +1,5 @@
<?php
use Kirby\Cms\ModelWithContent;
use Kirby\Form\Form;
use Kirby\Toolkit\I18n;
use Kirby\Toolkit\Str;
@@ -22,7 +20,7 @@ return [
return in_array($layout, $layouts) ? $layout : 'list';
},
/**
* 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`
* 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`
*/
'size' => function (string $size = 'auto') {
return $size;
@@ -30,7 +28,7 @@ return [
],
'computed' => [
'columns' => function () {
$columns = [];
$columns = [];
if ($this->layout !== 'table') {
return [];
@@ -78,12 +76,9 @@ return [
// keep the original column name as id
$column['id'] = $columnName;
// add the custom column to the array
// allowing to extend/overwrite existing columns
$columns[$columnName] = [
...$columns[$columnName] ?? [],
...$column
];
// add the custom column to the array with a key that won't
// override the system columns
$columns[$columnName . 'Cell'] = $column;
}
if ($this->type === 'pages') {
@@ -99,27 +94,7 @@ return [
},
],
'methods' => [
'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) {
'columnsValues' => function (array $item, $model) {
$item['title'] = [
// override toSafeString() coming from `$item`
// because the table cells don't use v-html
@@ -133,20 +108,19 @@ return [
$item['info'] = $model->toString($this->info);
}
// Use form to get the proper values for the columns
$form = Form::for($model)->values();
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] ??
$form[$column['id'] ?? $columnName] ??
null,
};
// don't overwrite essential columns
if (isset($item[$columnName]) === true) {
continue;
}
if (empty($column['value']) === false) {
$value = $model->toString($column['value']);
} else {
$value = $model->content()->get($column['id'] ?? $columnName)->value();
}
$item[$columnName] = $value;
}
return $item;

View File

@@ -1,9 +1,5 @@
<?php
use Kirby\Cms\File;
use Kirby\Cms\Page;
use Kirby\Cms\Site;
use Kirby\Cms\User;
use Kirby\Exception\Exception;
return [
@@ -28,10 +24,10 @@ return [
}
if (
$parent instanceof Page === false &&
$parent instanceof Site === false &&
$parent instanceof File === false &&
$parent instanceof User === false
is_a($parent, 'Kirby\Cms\Page') === false &&
is_a($parent, 'Kirby\Cms\Site') === false &&
is_a($parent, 'Kirby\Cms\File') === false &&
is_a($parent, 'Kirby\Cms\User') === false
) {
throw new Exception('The parent for the section "' . $this->name() . '" has to be a page, site or user object');
}

View File

@@ -12,7 +12,7 @@ return [
}
],
'methods' => [
'searchterm' => function (): string|null {
'searchterm' => function (): ?string {
return App::instance()->request()->get('searchterm');
}
]

View File

@@ -39,10 +39,6 @@ return [
return false;
}
if ($this->query !== null) {
return false;
}
if ($this->sortBy !== null) {
return false;
}