<?php
declare(strict_types=1);
namespace Juki\Bundle\AppBundle\EventListener;
use Doctrine\Common\Util\Debug;
use Hitso\Bundle\FormBundle\Event\FormEvent;
use Hitso\Bundle\SectionBundle\Entity\Section\ProductListSection;
use Hitso\Bundle\SectionBundle\Form\Section\ProductsListSectionType;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotNull;
/**
* Class CtaBlockSectionSubscriber
*
* @package Juki\Bundle\AppBundle\EventListener
*/
final class CtaBlockSectionSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return [
'section.form_init' => 'onFormInit',
];
}
public function onFormInit(FormEvent $event)
{
$builder = $event->getBuilder();
if ($builder->getName() === "cta_block_section") {
$builder->add(
'mode',
ChoiceType::class,
[
'label' => 'Rodzaj widoku',
'choices' => [
'jasny' => 'light',
'ciemny' => 'dark',
],
'position' => ['after' => 'identifier'],
]
);
}
}
}