downgrade to kirby v3
This commit is contained in:
@@ -5,7 +5,7 @@ use Kirby\Toolkit\I18n;
|
||||
return function (array $props) {
|
||||
$props['sections'] = [
|
||||
'files' => [
|
||||
'label' => $props['label'] ?? $props['headline'] ?? I18n::translate('files'),
|
||||
'headline' => $props['headline'] ?? I18n::translate('files'),
|
||||
'type' => 'files',
|
||||
'layout' => $props['layout'] ?? 'cards',
|
||||
'template' => $props['template'] ?? null,
|
||||
@@ -17,7 +17,6 @@ return function (array $props) {
|
||||
// remove global options
|
||||
unset(
|
||||
$props['headline'],
|
||||
$props['label'],
|
||||
$props['layout'],
|
||||
$props['template'],
|
||||
$props['image']
|
||||
|
||||
@@ -10,7 +10,7 @@ return function ($props) {
|
||||
|
||||
if (is_string($props) === true) {
|
||||
$props = [
|
||||
'label' => $props
|
||||
'headline' => $props
|
||||
];
|
||||
}
|
||||
|
||||
@@ -27,24 +27,24 @@ return function ($props) {
|
||||
|
||||
if ($pages !== false) {
|
||||
$sidebar['pages'] = $section([
|
||||
'label' => I18n::translate('pages'),
|
||||
'type' => 'pages',
|
||||
'status' => 'all',
|
||||
'layout' => 'list',
|
||||
'headline' => I18n::translate('pages'),
|
||||
'type' => 'pages',
|
||||
'status' => 'all',
|
||||
'layout' => 'list',
|
||||
], $pages);
|
||||
}
|
||||
|
||||
if ($files !== false) {
|
||||
$sidebar['files'] = $section([
|
||||
'label' => I18n::translate('files'),
|
||||
'type' => 'files',
|
||||
'layout' => 'list'
|
||||
'headline' => I18n::translate('files'),
|
||||
'type' => 'files',
|
||||
'layout' => 'list'
|
||||
], $files);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($sidebar) === true) {
|
||||
$props['fields'] ??= [];
|
||||
$props['fields'] = $props['fields'] ?? [];
|
||||
|
||||
unset(
|
||||
$props['files'],
|
||||
|
||||
@@ -6,12 +6,12 @@ return function (array $props) {
|
||||
// load the general templates setting for all sections
|
||||
$templates = $props['templates'] ?? null;
|
||||
|
||||
$section = function ($label, $status, $props) use ($templates) {
|
||||
$section = function ($headline, $status, $props) use ($templates) {
|
||||
$defaults = [
|
||||
'label' => $label,
|
||||
'type' => 'pages',
|
||||
'layout' => 'list',
|
||||
'status' => $status
|
||||
'headline' => $headline,
|
||||
'type' => 'pages',
|
||||
'layout' => 'list',
|
||||
'status' => $status
|
||||
];
|
||||
|
||||
if ($props === true) {
|
||||
@@ -20,13 +20,13 @@ return function (array $props) {
|
||||
|
||||
if (is_string($props) === true) {
|
||||
$props = [
|
||||
'label' => $props
|
||||
'headline' => $props
|
||||
];
|
||||
}
|
||||
|
||||
// inject the global templates definition
|
||||
if (empty($templates) === false) {
|
||||
$props['templates'] ??= $templates;
|
||||
$props['templates'] = $props['templates'] ?? $templates;
|
||||
}
|
||||
|
||||
return array_replace_recursive($defaults, $props);
|
||||
|
||||
Reference in New Issue
Block a user