create design to light page structure and content
This commit is contained in:
parent
8a2b90c8c0
commit
5a80cfaa81
9 changed files with 169 additions and 0 deletions
45
public/site/blueprints/pages/design-to-light.yml
Normal file
45
public/site/blueprints/pages/design-to-light.yml
Normal 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
|
||||
|
|
@ -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',
|
||||
|
|
|
|||
40
public/site/templates/design-to-light.json.php
Normal file
40
public/site/templates/design-to-light.json.php
Normal 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
|
||||
]);
|
||||
1
public/site/templates/design-to-light.php
Normal file
1
public/site/templates/design-to-light.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
<?php snippet('generic-template') ?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue