world-game/site/templates/portfolio.json.php
isUnknown 133651c35d
All checks were successful
Deploy / Deploy to Production (push) Successful in 19s
portfolio : animation horizontale — toggle panel + composant
Ajout du mode horizontal dans GalleryAnimation (5 rangées, scrollLeft/scrollRight)
avec toggle vertical/horizontal dans le panel projet.

refs #21

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:37:05 +01:00

38 lines
1.9 KiB
PHP

<?php
$specificData = [
'backgroundImage' => $page->backgroundImage()->toFile()?->url(),
'projects' => $page->children()->listed()->map(function($project) {
return [
'title' => $project->title()->value(),
'slug' => $project->slug(),
'catchPhrase' => $project->catchPhrase()->value(),
'description' => $project->description()->value(),
'thumbnail' => $project->thumbnail()->toFile()?->url(),
'imagesGallery' => $project->imagesGallery()->toFiles()->map(fn($f) => [
'src' => $f->url(),
'srcset' => $f->srcset('gallery'),
'webp' => $f->srcset('gallery-webp'),
])->values(),
'mockup' => $project->mockup()->toFile()?->url(),
'mockupSrcset' => $project->mockup()->toFile()?->srcset('mockup'),
'mockupWebp' => $project->mockup()->toFile()?->srcset('mockup-webp'),
'galleryAnimationMode' => $project->galleryAnimationMode()->value() ?: 'vertical',
'galleryBackgroundColor' => $project->galleryBackgroundColor()->value(),
'galleryBackgroundImage' => $project->galleryBackgroundImage()->isNotEmpty() ? $project->galleryBackgroundImage()->toFile()->url() : null,
'keywords' => $project->keywords()->toStructure()->map(fn($i) => [
'label' => $i->label()->value(),
'text' => $i->text()->value(),
])->values(),
'externalLinks' => $project->externalLinks()->toStructure()->map(fn($i) => [
'label' => $i->label()->value(),
'url' => $i->url()->value(),
])->values(),
];
})->values()
];
$pageData = array_merge($genericData, $specificData);
header('Content-Type: application/json');
echo json_encode($pageData);