37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
|
|
<?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',
|
||
|
|
];
|