25 lines
939 B
PHP
25 lines
939 B
PHP
<?php
|
|
|
|
$specificData = [
|
|
'hero' => [
|
|
'subtitle' => $page->subtitle()->inline()->value(),
|
|
'ctaText' => $page->ctaText()->value(),
|
|
'ctaPath' => $page->ctaLink()->toPage()?->id() ?? '#',
|
|
'image' => $page->heroImage()->toFile()?->url()
|
|
],
|
|
'backgroundVideo' => $page->backgroundVideo()->toFile()?->url(),
|
|
'backgroundVideoPoster' => $page->backgroundVideoPoster()->toFile()?->url(),
|
|
'backgroundVideoMobile' => $page->backgroundVideoMobile()->toFile()?->url(),
|
|
'backgroundVideoMobilePoster' => $page->backgroundVideoMobilePoster()->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);
|