- 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>
26 lines
837 B
PHP
26 lines
837 B
PHP
<?php
|
|
|
|
$specificData = [
|
|
'intro' => [
|
|
'title' => $page->introTitle()->value(),
|
|
'text' => $page->introText()->value()
|
|
],
|
|
'articles' => $page->children()->listed()->sortBy('date', 'desc')->map(function($article) {
|
|
return [
|
|
'title' => $article->title()->value(),
|
|
'slug' => $article->slug(),
|
|
'url' => $article->url(),
|
|
'date' => $article->date()->toDate('Y-m-d'),
|
|
'dateFormatted' => $article->date()->toDate('d/m/Y'),
|
|
'intro' => $article->intro()->excerpt(200),
|
|
'cover' => $article->cover()->toFile()?->url(),
|
|
'authorName' => $article->authorName()->value(),
|
|
'authorPhoto' => $article->authorPhoto()->toFile()?->url()
|
|
];
|
|
})->values()
|
|
];
|
|
|
|
$pageData = array_merge($genericData, $specificData);
|
|
|
|
header('Content-Type: application/json');
|
|
echo json_encode($pageData);
|