Toggle favorite working

This commit is contained in:
isUnknown 2024-09-11 07:32:34 +02:00
parent 5e3f4ec621
commit 4ea2871c6d
13 changed files with 300 additions and 169 deletions

View file

@ -16,89 +16,10 @@ return [
'language' => 'fr',
'css' => 'assets/css/panel.css',
'favicon' => 'assets/favicons/favicon.svg',
'menu' => [
'site' => [
'label' => 'Dashboard',
'icon' => 'dashboard',
'current' => function (string $current): bool {
// the links of all your custom menu entries
$links = [
'pages/clients',
'pages/projects',
'pages/inspirations',
'pages/notifications',
'pages/events'
];
$path = Kirby\Cms\App::instance()->path();
return
$current === 'site' &&
A::every($links, fn ($link) => Str::contains($path, $link) === false);
}
],
'clients' => [
'label' => 'Clients',
'icon' => 'account',
'link' => 'pages/clients',
'current' => function (string $current): bool {
$path = Kirby\Cms\App::instance()->path();
return Str::contains($path, 'pages/clients');
}
],
'projects' => [
'label' => 'Projets',
'icon' => 'folder',
'link' => 'pages/projects',
'current' => function (string $current): bool {
$path = Kirby\Cms\App::instance()->path();
return Str::contains($path, 'pages/projects');
}
],
'inspirations' => [
'label' => 'Inspirations',
'icon' => 'images',
'link' => 'pages/inspirations',
'current' => function (string $current): bool {
$path = Kirby\Cms\App::instance()->path();
return Str::contains($path, 'pages/inspirations');
}
],
'-',
'notifications' => [
'label' => 'Notifications',
'icon' => 'bell',
'link' => 'pages/notifications',
'current' => function (string $current): bool {
$path = Kirby\Cms\App::instance()->path();
return Str::contains($path, 'pages/notifications');
}
],
'events' => [
'label' => 'Événements',
'icon' => 'calendar',
'link' => 'pages/events',
'current' => function (string $current): bool {
$path = Kirby\Cms\App::instance()->path();
return Str::contains($path, 'pages/events');
}
],
'-',
'users',
'system'
]
'menu' => require(__DIR__ . '/menu.php'),
],
'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>';
}
]
require(__DIR__ . '/routes/logout.php'),
require(__DIR__ . '/routes/toggle-favorite.php'),
]
];