2024-09-04 11:28:12 +02:00
|
|
|
<?php
|
2024-11-11 17:12:26 +01:00
|
|
|
$children = $page->children()->filter(function ($child) {
|
|
|
|
|
return kirby()->user()->role() === 'admin' || $child->managers()->toUsers()->has(kirby()->user());
|
|
|
|
|
})->map(function ($child) {
|
2024-09-04 11:28:12 +02:00
|
|
|
return [
|
|
|
|
|
'title' => $child->title()->value(),
|
|
|
|
|
'url' => $child->url(),
|
2024-09-17 17:31:03 +02:00
|
|
|
'uri' => '/' . $child->uri(),
|
2024-09-10 11:02:13 +02:00
|
|
|
'modified' => $child->modified('Y-MM-d'),
|
2024-11-05 14:26:23 +01:00
|
|
|
'currentStep' => $child->currentStep()->value(),
|
2024-09-04 11:33:58 +02:00
|
|
|
'status' => $child->status(),
|
2024-09-26 17:21:24 +02:00
|
|
|
'logo' => $child->client()->toPage()->logo()->toFile()->url(),
|
2024-09-04 11:28:12 +02:00
|
|
|
];
|
|
|
|
|
})->values();
|
|
|
|
|
|
2024-11-11 17:12:26 +01:00
|
|
|
|
2024-09-04 11:28:12 +02:00
|
|
|
$specificData = [
|
|
|
|
|
"children" => $children,
|
|
|
|
|
];
|
|
|
|
|
|
2024-10-28 15:33:52 +01:00
|
|
|
$pageData = array_merge($genericData, $specificData);
|
2024-09-04 11:28:12 +02:00
|
|
|
|
2024-10-28 15:33:52 +01:00
|
|
|
echo json_encode([
|
|
|
|
|
"page" => $pageData,
|
|
|
|
|
"user" => $userData
|
|
|
|
|
]);
|