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

25 lines
776 B
PHP
Raw Normal View History

<?php
$specificData = [
'hero' => [
'title' => $page->hero_title()->value(),
'title_highlight' => $page->hero_title_highlight()->value(),
'subtitle' => $page->hero_subtitle()->value(),
'ctaText' => $page->ctaText()->value(),
'ctaPath' => $page->ctaLink()->toPage()?->id() ?? '#',
'image' => $page->hero_image()->toFile()?->url()
],
'background_video' => $page->background_video()->toFile()?->url(),
'floating_bubbles' => $page->floating_bubbles()->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);