collection -> inspiration

This commit is contained in:
isUnknown 2024-09-10 12:09:53 +02:00
parent dfda911664
commit 0d41b27cc3
9 changed files with 61 additions and 16 deletions

View file

@ -85,5 +85,20 @@ return [
'users',
'system'
]
],
'routes' => [
[
'pattern' => '(:all)logout.php',
'action' => function () {
$kirby = kirby();
$user = $kirby->user();
$user->logout();
session_start();
go($_SESSION['redirect_url']);
return '<html><body>logout</body></html>';
}
]
]
];

View file

@ -1,3 +1,15 @@
<script>
const kirbyData = {
user: {
role: '<?= $kirby->user()->role() ?>',
<?php if ($kirby->user()->role() == 'client'): ?>
client: {
name: '<?= $kirby->user()->client()->toPage()->title() ?>',
uuid: '<?= $kirby->user()->client()->toPage()->uuid() ?>',
}
<?php endif ?>
}
}
</script>
</body>
</html>

View file

@ -1,8 +1,9 @@
<?php
$collections = $page->children()->map(function ($child) {
$inspirations = $page->children()->map(function ($child) {
return [
'title' => $child->title()->value(),
'description' => $child->description()->value(),
'new' => $child->new()->value() === "true" ? true : false,
'date' => $child->date()->toDate('Y-MM-d'),
'url' => $child->url(),
@ -18,7 +19,7 @@ $collections = $page->children()->map(function ($child) {
})->values();
$specificData = [
"collections" => $collections
"inspirations" => $inspirations
];
$data = array_merge($genericData, $specificData);