Skip to content

Commit

Permalink
Add FrontendMenuEvent (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho authored Feb 11, 2023
1 parent d07e73c commit c4b5a9e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions src/Event/FrontendMenuEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

/*
* This file is part of richardhj/contao-knp-menu.
*
* (c) Richard Henkenjohann <[email protected]>
*
* @license MIT
*/

namespace Richardhj\ContaoKnpMenuBundle\Event;

use Contao\CoreBundle\Event\MenuEvent;

class FrontendMenuEvent extends MenuEvent
{
}
4 changes: 2 additions & 2 deletions src/Menu/MenuBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace Richardhj\ContaoKnpMenuBundle\Menu;

use Contao\CoreBundle\Event\MenuEvent;
use Contao\CoreBundle\Framework\ContaoFramework;
use Contao\Database;
use Contao\Environment;
Expand All @@ -23,6 +22,7 @@
use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Knp\Menu\MenuItem;
use Richardhj\ContaoKnpMenuBundle\Event\FrontendMenuEvent;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

Expand Down Expand Up @@ -130,7 +130,7 @@ public function getMenu(ItemInterface $root, int $pid, $level = 1, $host = null,
$root->addChild($item);
}

$menuEvent = new MenuEvent($this->factory, $root);
$menuEvent = new FrontendMenuEvent($this->factory, $root);
$this->dispatcher->dispatch($menuEvent);

return $root;
Expand Down

0 comments on commit c4b5a9e

Please sign in to comment.