- Blueprints : renommage des champs (member_name, related_articles, background_video, play_links, images_gallery, external_links) et des noms de sections - Templates JSON PHP : clés de sortie et appels ->method() en camelCase - Vues Svelte (Play, Portfolio) : accès aux données alignés Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
1.5 KiB
PHP
34 lines
1.5 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(),
|
|
'galleryBackgroundColor' => $project->galleryBackgroundColor()->value(),
|
|
'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);
|