24 lines
860 B
PHP
24 lines
860 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
$specificData = [
|
||
|
|
'games' => $page->children()->listed()->map(function($game) {
|
||
|
|
return [
|
||
|
|
'title' => $game->title()->value(),
|
||
|
|
'slug' => $game->slug(),
|
||
|
|
'lettering' => $game->lettering()->toFile()?->url(),
|
||
|
|
'description' => $game->description()->value(),
|
||
|
|
'thumbnail' => $game->thumbnail()->toFile()?->url(),
|
||
|
|
'background_image' => $game->background_image()->toFile()?->url(),
|
||
|
|
'play_links' => $game->play_links()->toStructure()->map(fn($l) => [
|
||
|
|
'label' => $l->label()->value(),
|
||
|
|
'url' => $l->url()->value(),
|
||
|
|
])->values(),
|
||
|
|
];
|
||
|
|
})->values()
|
||
|
|
];
|
||
|
|
|
||
|
|
$pageData = array_merge($genericData, $specificData);
|
||
|
|
|
||
|
|
header('Content-Type: application/json');
|
||
|
|
echo json_encode($pageData);
|