src/Juki/Bundle/AppBundle/EventListener/AttributeSubscriber.php line 32

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Juki\Bundle\AppBundle\EventListener;
  4. use Hitso\Bundle\FormBundle\Event\FormEvent;
  5. use Hitso\Bundle\MultiSiteBundle\MultiSite\SiteCollection;
  6. use Hitso\Bundle\MultiSiteBundle\MultiSite\SiteContext;
  7. use Juki\Bundle\AppBundle\Entity\Dictionary\Shop;
  8. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  9. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  10. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  11. use Symfony\Component\HttpKernel\Event\RequestEvent;
  12. use Symfony\Component\HttpKernel\HttpKernelInterface;
  13. use Symfony\Component\HttpKernel\KernelEvents;
  14. /**
  15.  * Class AttributeSubscriber
  16.  *
  17.  * @package Juki\Bundle\AppBundle\EventListener
  18.  */
  19. final class AttributeSubscriber implements EventSubscriberInterface
  20. {
  21.     public static function getSubscribedEvents()
  22.     {
  23.         return [
  24.             'attribute_type.form_init' => 'onFormInit',
  25.         ];
  26.     }
  27.     public function onFormInit(FormEvent $event)
  28.     {
  29.         $builder $event->getBuilder();
  30.         $builder->add(
  31.             'scope',
  32.             CheckboxType::class,
  33.             [
  34.                 'label'    => 'Wyƛwietlaj jako zakres',
  35.                 'required' => false,
  36.                 'position' => ['after' => 'position'],
  37.             ]
  38.         );
  39.     }
  40. }