src/Form/Type/HTMLType.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type;
  3. use Symfony\Component\Form\Extension\Core\Type\TextType;
  4. use Symfony\Component\Form\FormBuilderInterface;
  5. use Symfony\Component\Form\FormInterface;
  6. use Symfony\Component\Form\FormView;
  7. use Symfony\Component\OptionsResolver\OptionsResolver;
  8. class HTMLType extends TextType
  9. {
  10.     /**
  11.      * {@inheritdoc}
  12.      */
  13.     public function configureOptions(OptionsResolver $resolver)
  14.     {
  15.         parent::configureOptions($resolver);
  16.         $resolver->setDefined('template');
  17.         $resolver->setDefaults([
  18.             'mapped' => false,
  19.             'template' => null,
  20.             'object' => null,
  21.             'align' => null,
  22.             'disabled' => false
  23.         ]);
  24.     }
  25.     public function buildView(FormView $viewFormInterface $form, array $options)
  26.     {
  27.         parent::buildView($view$form$options);
  28.         $view->vars['template'] = $options['template'];
  29.         $view->vars['object'] = $options['object'];
  30.         $view->vars['align'] = $options['align'];
  31.         $view->vars['disabled'] = $options['disabled'];
  32.     }
  33.     /**
  34.      * {@inheritdoc}
  35.      */
  36.     public function getName()
  37.     {
  38.         return $this->getBlockPrefix();
  39.     }
  40.     /**
  41.      * {@inheritdoc}
  42.      */
  43.     public function getBlockPrefix()
  44.     {
  45.         return 'html';
  46.     }
  47. }