src/Form/EventListener/Admin/PaymentMethod/Gateway/AddConfigurationFieldSubscriber.php line 22

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Form\EventListener\Admin\PaymentMethod\Gateway;
  4. use App\Form\Admin\PaymentMethod\GatewayCustomType;
  5. use App\Form\Admin\PaymentMethod\GlobalGatewayCustomType;
  6. use App\Form\FormHelper;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  9. use Symfony\Component\Form\FormEvent;
  10. use Symfony\Component\Form\FormEvents;
  11. class AddConfigurationFieldSubscriber extends FormHelper implements EventSubscriberInterface
  12. {
  13.     public static function getSubscribedEvents(): array
  14.     {
  15.         return [FormEvents::PRE_SET_DATA => 'preSetData'];
  16.     }
  17.     public function preSetData(FormEvent $event): void
  18.     {
  19.         $event->getForm()->add('config'CollectionType::class, $this->getCollectionParameters(
  20.             GatewayCustomType::class,
  21.             ['label' => false],
  22.             false
  23.         ));
  24.         $event->getForm()->add('globalConfig'CollectionType::class, $this->getCollectionParameters(
  25.             GlobalGatewayCustomType::class,
  26.             ['label' => false],
  27.             false
  28.         ));
  29.     }
  30. }