world-game/site/templates/play.json.php
isUnknown 1cce398ee4
All checks were successful
Deploy / Deploy to Production (push) Successful in 21s
play page : replace backgroundColor with backgroundImage, remove curves. closes #37
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 15:07:30 +01:00

23 lines
906 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(),
'thumbnailSrcset' => $game->thumbnail()->toFile()?->srcset('thumbnail'),
'thumbnailWebp' => $game->thumbnail()->toFile()?->srcset('thumbnail-webp'),
'backgroundImage' => $game->backgroundImage()->toFile()?->url(),
'preview' => $game->preview()->toFile()?->url(),
'playLink' => $game->playLink()->value() ?: null,
];
})->values()
];
$pageData = array_merge($genericData, $specificData);
header('Content-Type: application/json');
echo json_encode($pageData);