add default navigation setting event subscriber
This commit is contained in:
parent
750ebeb90e
commit
7a98667361
63
src/EventSuscriber/NavigationSettingEventSubscriber.php
Normal file
63
src/EventSuscriber/NavigationSettingEventSubscriber.php
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\EventSuscriber;
|
||||||
|
|
||||||
|
use App\Core\Event\Setting\NavigationSettingEvent;
|
||||||
|
use App\Core\EventSuscriber\NavigationSettingEventSubscriber as EventSubscriber;
|
||||||
|
use App\Core\Setting\NavigationSettingManager;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class NavigationSettingEventSubscriber.
|
||||||
|
*
|
||||||
|
* @author Simon Vieille <simon@deblan.fr>
|
||||||
|
*/
|
||||||
|
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,
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue