Refactor: config Kirby scindée en menu.php + thumbs.php
All checks were successful
Deploy / Deploy to Production (push) Successful in 17s

- menu.php: helper menuItem() — détection active mutualisée
- thumbs.php: helpers srcsetPreset/srcsetPair — widths définis une seule fois,
  paires normal/webp générées automatiquement sans duplication
- config.php: réduit à l'essentiel via require

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-03-10 08:21:06 +01:00
parent 0ea4bfe539
commit d42217fd20
3 changed files with 98 additions and 135 deletions

36
site/config/menu.php Normal file
View file

@ -0,0 +1,36 @@
<?php
/**
* Helper : génère un item de menu avec détection automatique du lien actif.
*/
function menuItem(string $id, string $label, string $icon, string $link): array
{
return [
'label' => $label,
'icon' => $icon,
'link' => $link,
'current' => function () use ($link): bool {
return Str::contains(Kirby\Cms\App::instance()->path(), $link);
},
];
}
return [
'site' => [
'label' => 'Données partagées',
'icon' => 'cog',
'current' => function (): bool {
return Str::contains(Kirby\Cms\App::instance()->path(), '/site');
},
],
'-',
'home' => menuItem('home', 'Accueil', 'home', 'pages/home'),
'expertise' => menuItem('expertise', 'Expertise','wand', 'pages/expertise'),
'portfolio' => menuItem('portfolio', 'Portfolio','images', 'pages/portfolio'),
'jouer' => menuItem('jouer', 'Jouer', 'play', 'pages/jouer'),
'a-propos' => menuItem('a-propos', 'À propos', 'users', 'pages/a-propos'),
'blog' => menuItem('blog', 'Blog', 'text', 'pages/blog'),
'-',
'users',
'system',
];