create design to light page structure and content

This commit is contained in:
isUnknown 2025-01-21 17:50:59 +01:00
parent 8a2b90c8c0
commit 5a80cfaa81
9 changed files with 169 additions and 0 deletions

View file

@ -0,0 +1,45 @@
title: Design to light
tabs:
content:
fields:
sectionTitle:
label: Titre de la présentation
type: text
introduction:
label: Introduction
type: writer
marks: false
nodes: false
presentation:
label: Présentation
type: layout
layouts:
- 1/2, 1/2
- 1/3, 1/3, 1/3
fieldsets:
- type: button
name: Section
preview: fields
wysiwyg: true
icon: grid-full
fields:
cover:
label: Image
type: files
layout: cards
multiple: false
image:
ratio: 16/9
cover: truc
title:
label: Titre
type: text
text:
label: Texte
type: writer
marks: false
nodes:
- bulletList
files: tabs/files

View file

@ -38,6 +38,16 @@ return [
}
],
'-',
'design-to-light' => [
'label' => 'Design to light',
'icon' => 'circle',
'link' => 'pages/design-to-light',
'current' => function (string $current): bool {
$path = Kirby\Cms\App::instance()->path();
return Str::contains($path, 'pages/design-to-light');
}
],
'-',
'inspirations' => [
'label' => 'Inspirations',
'icon' => 'images',

View file

@ -0,0 +1,40 @@
<?php
$presentation = [];
foreach ($page->presentation()->toLayouts() as $layout) {
$row = [
'id' => $layout->id(),
'columns' => [],
];
foreach ($layout->columns() as $column) {
$columnData = [
'id' => $column->id(),
'blocks' => [],
];
foreach ($column->blocks() as $block) {
$blockData = [
'id' => $block->id(),
'content' => $block->content()->toArray(),
];
if ($block->cover()->isNotEmpty()) {
$blockData['content']['cover'] = getFileData($block->cover()->toFile());
}
$columnData['blocks'][] = $blockData;
}
$row['columns'][] = $columnData;
}
$presentation[] = $row;
}
$specificData = [
"presentation" => $presentation
];
$pageData = array_merge($genericData, $specificData);
echo json_encode([
"page" => $pageData,
"user" => $userData
]);

View file

@ -0,0 +1 @@
<?php snippet('generic-template') ?>