![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Form/Type/ |
<?php namespace Mautic\CoreBundle\Form\Type; use Mautic\FormBundle\Entity\FormRepository; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; class GatedVideoType extends SlotType { public function __construct( private FormRepository $formRepository ) { } public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add( 'url', UrlType::class, [ 'label' => 'Video URL', 'label_attr' => ['class' => 'control-label'], 'required' => true, 'attr' => [ 'class' => 'form-control', 'data-slot-param' => 'gatedvideo-url', ], ] ); $builder->add( 'gatetime', TextType::class, [ 'label' => 'Gate Time', 'label_attr' => ['class' => 'control-label'], 'required' => true, 'attr' => [ 'class' => 'form-control', 'data-slot-param' => 'gatedvideo-gatetime', ], ] ); $builder->add( 'formid', ChoiceType::class, [ 'label' => 'Form', 'label_attr' => ['class' => 'control-label'], 'required' => true, 'attr' => [ 'class' => 'form-control', 'data-slot-param' => 'gatedvideo-formid', ], 'placeholder' => 'Select your form', 'choices' => $this->getFormChoices(), ] ); $builder->add( 'width', TextType::class, [ 'label' => 'Width', 'label_attr' => ['class' => 'control-label'], 'required' => true, 'attr' => [ 'class' => 'form-control', 'data-slot-param' => 'gatedvideo-width', ], ] ); $builder->add( 'height', TextType::class, [ 'label' => 'Height', 'label_attr' => ['class' => 'control-label'], 'required' => true, 'attr' => [ 'class' => 'form-control', 'data-slot-param' => 'gatedvideo-height', ], ] ); parent::buildForm($builder, $options); } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults( [ 'width' => 640, 'height' => 320, ] ); } private function getFormChoices(): array { $formList = $this->formRepository->getSimpleList(); $formChoices = []; foreach ($formList as $formItem) { $formChoices["{$formItem['label']} (ID {$formItem['value']})"] = $formItem['value']; } return $formChoices; } }