<?php

/*
 * This file is part of the Serenity package.
 *
 * (c) CP Creation <web@cpcreation.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Serenity\CoreBundle\Menu\EventListener;

use Serenity\AdminBundle\Event\ParamsAdminMenuEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

/**
 * Écouteur de l’événement du menu d’administration.
 *
 * Ajoute dynamiquement une section "Général" au menu principal
 * du panneau d’administration lors du rendu.
 */
#[AsEventListener()]
readonly class ParamsAdminMenuListener
{
    public function __invoke(ParamsAdminMenuEvent $event): void
    {
        $menu = $event->getMenu();
        $menu?->addChild('general', [
            'label' => 'Général',
            'route' => 'core_settings_general',
        ]);
    }
}
