world-game/site/controllers/site.php
isUnknown 3e9657430f
All checks were successful
Deploy / Deploy to Production (push) Successful in 15s
Fix: champs camelCase + anglais, contact data, nettoyage debug
- Blueprint site.yml : renommage en camelCase (contactEmail, contactAddress, socialLinks, legalNotices)
- Controller site.php : mentionsLegales() → legalNotices(), fix (string) casts pour la sérialisation JSON
- state/site.svelte.js : ajout champ contact
- Menu.svelte : nouveau composant dialog pour le menu overlay
- Header.svelte : intégration Menu, animation hamburger CSS
- router/index.js : suppression des console.log de debug

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-19 13:43:50 +01:00

60 lines
1.9 KiB
PHP

<?php
return function ($page, $kirby, $site) {
$homePage = $site->find('home');
$navPages = $homePage
? $site->pages()->listed()->prepend($homePage->id(), $homePage)
: $site->pages()->listed();
// Generic page data available in all templates
$genericData = [
'title' => $page->title()->value(),
'url' => $page->url(),
'uri' => $page->uri(),
'template' => $page->intendedTemplate()->name(),
'modified' => $page->modified('Y-m-d'),
'site' => [
'title' => $site->site_title()->value(),
'url' => $site->url(),
'logo' => $site->logo()->toFile()?->url(),
'language' => $kirby->language()?->code() ?? 'fr',
'languages' => $kirby->languages()->map(function($l) {
return [
'code' => $l->code(),
'name' => $l->name()
];
})->values(),
'contact' => [
'email' => (string)$site->contactEmail()->value(),
'address' => (string)$site->contactAddress()->value(),
'socials' => $site->socialLinks()->toStructure()->map(function($item) {
return [
'label' => (string)$item->label()->value(),
'url' => (string)$item->url()->value(),
'picto' => (string)$item->picto()->value(),
];
})->values(),
'legalNotice' => $site->legalNotices()->toFile()?->url(),
],
'navigation' => $navPages->map(function($p) use ($kirby) {
$titles = [];
foreach ($kirby->languages() as $lang) {
$titles[$lang->code()] = $p->content($lang->code())->title()->value();
}
if (empty($titles)) {
$titles['fr'] = $p->title()->value();
}
return [
'id' => $p->uid(),
'url' => '/' . $p->uri(),
'title' => $p->title()->value(),
'titles' => $titles
];
})->values()
]
];
return [
'genericData' => $genericData
];
};