vendor/symfony/form/Extension/Core/Type/EmailType.php line 18

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\OptionsResolver\Options;
  13. use Symfony\Component\OptionsResolver\OptionsResolver;
  14. class EmailType extends AbstractType
  15. {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public function configureOptions(OptionsResolver $resolver)
  20. {
  21. $resolver->setDefaults([
  22. 'invalid_message' => function (Options $options, $previousValue) {
  23. return ($options['legacy_error_messages'] ?? true)
  24. ? $previousValue
  25. : 'Please enter a valid email address.';
  26. },
  27. ]);
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function getParent()
  33. {
  34. return TextType::class;
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function getBlockPrefix()
  40. {
  41. return 'email';
  42. }
  43. }