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

25 lines
644 B
PHP
Raw Normal View History

<?php
$specificData = [
'intro' => [
'title' => $page->intro_title()->value(),
'text' => $page->intro_text()->value()
],
'sections' => $page->expertise_sections()->toStructure()->map(function($section) {
return [
'title' => $section->title()->value(),
'icon' => $section->icon()->value(),
'content' => $section->content()->toBlocks()
];
})->values(),
'objective' => [
'title' => $page->objective_title()->value(),
'text' => $page->objective_text()->value()
]
];
$pageData = array_merge($genericData, $specificData);
header('Content-Type: application/json');
echo json_encode($pageData);