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

  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  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 <bschussek@gmail.com>
  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.     public function configureOptions(OptionsResolver $resolver)
  31.     {
  32.         $resolver->setDefault('validate'true);
  33.         $resolver->setAllowedTypes('validate''bool');
  34.     }
  35.     public function getParent(): ?string
  36.     {
  37.         return ButtonType::class;
  38.     }
  39.     public function getBlockPrefix(): string
  40.     {
  41.         return 'submit';
  42.     }
  43. }