ConfigureMenuEvent.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Event;
  11. use Knp\Menu\FactoryInterface;
  12. use Knp\Menu\ItemInterface;
  13. use Symfony\Component\EventDispatcher\Event;
  14. /**
  15. * Menu builder event. Used for extending the menus.
  16. *
  17. * @author Martin Hasoň <martin.hason@gmail.com>
  18. */
  19. class ConfigureMenuEvent extends Event
  20. {
  21. const SIDEBAR = 'sonata.admin.event.configure.menu.sidebar';
  22. private $factory;
  23. private $menu;
  24. /**
  25. * @param FactoryInterface $factory
  26. * @param ItemInterface $menu
  27. */
  28. public function __construct(FactoryInterface $factory, ItemInterface $menu)
  29. {
  30. $this->factory = $factory;
  31. $this->menu = $menu;
  32. }
  33. /**
  34. * @return FactoryInterface
  35. */
  36. public function getFactory()
  37. {
  38. return $this->factory;
  39. }
  40. /**
  41. * @return ItemInterface
  42. */
  43. public function getMenu()
  44. {
  45. return $this->menu;
  46. }
  47. }