vendor/symfony/form/Extension/Core/Type/SubmitType.php line 25

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <[email protected]>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Form\Extension\Core\Type;
  11. use Symfony\Component\Form\AbstractType;
  12. use Symfony\Component\Form\FormInterface;
  13. use Symfony\Component\Form\FormView;
  14. use Symfony\Component\Form\SubmitButtonTypeInterface;
  15. use Symfony\Component\OptionsResolver\OptionsResolver;
  16. /**
  17.  * A submit button.
  18.  *
  19.  * @author Bernhard Schussek <[email protected]>
  20.  */
  21. class SubmitType extends AbstractType implements SubmitButtonTypeInterface
  22. {
  23.     public function buildView(FormView $viewFormInterface $form, array $options)
  24.     {
  25.         $view->vars['clicked'] = $form->isClicked();
  26.         if (!$options['validate']) {
  27.             $view->vars['attr']['formnovalidate'] = true;
  28.         }
  29.     }
  30.     /**
  31.      * {@inheritdoc}
  32.      */
  33.     public function configureOptions(OptionsResolver $resolver)
  34.     {
  35.         $resolver->setDefault('validate'true);
  36.         $resolver->setAllowedTypes('validate''bool');
  37.     }
  38.     /**
  39.      * {@inheritdoc}
  40.      */
  41.     public function getParent()
  42.     {
  43.         return ButtonType::class;
  44.     }
  45.     /**
  46.      * {@inheritdoc}
  47.      */
  48.     public function getBlockPrefix()
  49.     {
  50.         return 'submit';
  51.     }
  52. }