world-game/site/templates/home.json.php

25 lines
766 B
PHP
Raw Normal View History

<?php
$specificData = [
'hero' => [
'title' => $page->heroTitle()->value(),
'titleHighlight' => $page->heroTitleHighlight()->value(),
'subtitle' => $page->heroSubtitle()->value(),
'ctaText' => $page->ctaText()->value(),
'ctaPath' => $page->ctaLink()->toPage()?->id() ?? '#',
'image' => $page->heroImage()->toFile()?->url()
],
'backgroundVideo' => $page->backgroundVideo()->toFile()?->url(),
'floatingBubbles' => $page->floatingBubbles()->toStructure()->map(function($bubble) {
return [
'text' => $bubble->text()->value(),
'position' => $bubble->position()->value()
];
})->values()
];
$pageData = array_merge($genericData, $specificData);
header('Content-Type: application/json');
echo json_encode($pageData);