diff --git a/src/EventSuscriber/SettingEventSubscriber.php b/src/EventSuscriber/SettingEventSubscriber.php new file mode 100644 index 0000000..45f313e --- /dev/null +++ b/src/EventSuscriber/SettingEventSubscriber.php @@ -0,0 +1,58 @@ + + */ +class SettingEventSubscriber extends EventSubscriber +{ + protected SettingManager $manager; + + public function __construct(SettingManager $manager) + { + $this->manager = $manager; + } + + public function onInit(SettingEvent $event) + { + // $this->manager->init('myapp_foo', 'My app', 'Foo', 'Default value'); + // $this->manager->init('myapp_bar', 'My app', 'Bar', true); + } + + public function onFormInit(SettingEvent $event) + { + $data = $event->getData(); + $builder = $data['builder']; + $entity = $data['entity']; + + // if ('myapp_foo' === $entity->getCode()) { + // $builder->add( + // 'value', + // TextType::class, + // [ + // 'label' => $entity->getLabel(), + // ] + // ); + // } + // + // if ('myapp_bar' === $entity->getCode()) { + // $builder->add( + // 'value', + // CheckboxType::class, + // [ + // 'label' => $entity->getLabel(), + // 'required' => false, + // ] + // ); + // } + } +}