ConfigureMenuEvent.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. /**
  23. * @var FactoryInterface
  24. */
  25. private $factory;
  26. /**
  27. * @var ItemInterface
  28. */
  29. private $menu;
  30. /**
  31. * @param FactoryInterface $factory
  32. * @param ItemInterface $menu
  33. */
  34. public function __construct(FactoryInterface $factory, ItemInterface $menu)
  35. {
  36. $this->factory = $factory;
  37. $this->menu = $menu;
  38. }
  39. /**
  40. * @return FactoryInterface
  41. */
  42. public function getFactory()
  43. {
  44. return $this->factory;
  45. }
  46. /**
  47. * @return ItemInterface
  48. */
  49. public function getMenu()
  50. {
  51. return $this->menu;
  52. }
  53. }