30 lines
766 B
PHP
30 lines
766 B
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' => 'Accueil',
|
|
'icon' => 'home',
|
|
'current' => function (): bool {
|
|
return Str::contains(Kirby\Cms\App::instance()->path(), '/site');
|
|
},
|
|
],
|
|
'news' => menuItem('news', 'Actualités', 'calendar', 'pages/actualites'),
|
|
'-',
|
|
'users',
|
|
'system',
|
|
];
|