init with kirby, vue and pagedjs interactive
This commit is contained in:
commit
dc0ae26464
968 changed files with 211706 additions and 0 deletions
75
public/kirby/config/presets/pages.php
Normal file
75
public/kirby/config/presets/pages.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return function (array $props) {
|
||||
// load the general templates setting for all sections
|
||||
$templates = $props['templates'] ?? null;
|
||||
|
||||
$section = function ($label, $status, $props) use ($templates) {
|
||||
$defaults = [
|
||||
'label' => $label,
|
||||
'type' => 'pages',
|
||||
'layout' => 'list',
|
||||
'status' => $status
|
||||
];
|
||||
|
||||
if ($props === true) {
|
||||
$props = [];
|
||||
}
|
||||
|
||||
if (is_string($props) === true) {
|
||||
$props = [
|
||||
'label' => $props
|
||||
];
|
||||
}
|
||||
|
||||
// inject the global templates definition
|
||||
if (empty($templates) === false) {
|
||||
$props['templates'] ??= $templates;
|
||||
}
|
||||
|
||||
return array_replace_recursive($defaults, $props);
|
||||
};
|
||||
|
||||
$sections = [];
|
||||
|
||||
$drafts = $props['drafts'] ?? [];
|
||||
$unlisted = $props['unlisted'] ?? false;
|
||||
$listed = $props['listed'] ?? [];
|
||||
|
||||
|
||||
if ($drafts !== false) {
|
||||
$sections['drafts'] = $section(
|
||||
I18n::translate('pages.status.draft'),
|
||||
'drafts',
|
||||
$drafts
|
||||
);
|
||||
}
|
||||
|
||||
if ($unlisted !== false) {
|
||||
$sections['unlisted'] = $section(
|
||||
I18n::translate('pages.status.unlisted'),
|
||||
'unlisted',
|
||||
$unlisted
|
||||
);
|
||||
}
|
||||
|
||||
if ($listed !== false) {
|
||||
$sections['listed'] = $section(
|
||||
I18n::translate('pages.status.listed'),
|
||||
'listed',
|
||||
$listed
|
||||
);
|
||||
}
|
||||
|
||||
// cleaning up
|
||||
unset(
|
||||
$props['drafts'],
|
||||
$props['unlisted'],
|
||||
$props['listed'],
|
||||
$props['templates']
|
||||
);
|
||||
|
||||
return [...$props, 'sections' => $sections];
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue