All checks were successful
Deploy / Deploy to Production (push) Successful in 19s
closes #3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
835 B
PHP
30 lines
835 B
PHP
<?php
|
|
|
|
$bodyBlocks = [];
|
|
foreach ($page->body()->toBlocks() as $block) {
|
|
if ($block->type() === 'text') {
|
|
$bodyBlocks[] = [
|
|
'type' => 'text',
|
|
'html' => $block->content()->text()->value()
|
|
];
|
|
}
|
|
}
|
|
|
|
$specificData = [
|
|
'heading' => $page->heading()->value(),
|
|
'subtitle' => $page->subtitle()->value(),
|
|
'body' => $bodyBlocks,
|
|
'team' => $page->files()->template('member')->sort('sort')->map(function ($file) {
|
|
return [
|
|
'name' => $file->memberName()->value(),
|
|
'role' => $file->role()->value(),
|
|
'photo' => $file->url(),
|
|
'link' => $file->link()->value() ?: null,
|
|
];
|
|
})->values()
|
|
];
|
|
|
|
$pageData = array_merge($genericData, $specificData);
|
|
|
|
header('Content-Type: application/json');
|
|
echo json_encode($pageData);
|