From 7a98667361d5279d2095aa785fa53a6ec0208662 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Mon, 28 Jun 2021 15:57:05 +0200 Subject: [PATCH] add default navigation setting event subscriber --- .../NavigationSettingEventSubscriber.php | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/EventSuscriber/NavigationSettingEventSubscriber.php diff --git a/src/EventSuscriber/NavigationSettingEventSubscriber.php b/src/EventSuscriber/NavigationSettingEventSubscriber.php new file mode 100644 index 0000000..962b41b --- /dev/null +++ b/src/EventSuscriber/NavigationSettingEventSubscriber.php @@ -0,0 +1,63 @@ + + */ +class NavigationSettingEventSubscriber extends EventSubscriber +{ + protected NavigationSettingManager $manager; + + public function __construct(NavigationSettingManager $manager) + { + $this->manager = $manager; + } + + public function onInit(NavigationSettingEvent $event) + { + $data = $event->getData(); + $navigation = $data['navigation']; + + // $this->manager->init($navigation, 'nav_param1', 'Section', 'Param 1', 'Default value'); + // $this->manager->init($navigation, 'nav_param2', 'Section', 'Param 2', true); + } + + public function onFormInit(NavigationSettingEvent $event) + { + $data = $event->getData(); + $builder = $data['builder']; + $entity = $data['entity']; + + // if ('nav_param1' === $entity->getCode()) { + // $builder->add( + // 'value', + // CheckboxType::class, + // [ + // 'label' => $entity->getLabel(), + // 'required' => false, + // ] + // ); + // } + // + // if ('nav_param2' === $entity->getCode()) { + // $builder->add( + // 'value', + // CheckboxType::class, + // [ + // 'label' => $entity->getLabel(), + // 'required' => false, + // ] + // ); + // } + } +}