BirthdayField.php 796 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.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;
  11. /**
  12. * A field for entering a birthday date
  13. *
  14. * This field is a preconfigured DateField with allowed years between the
  15. * current year and 120 years in the past.
  16. *
  17. * @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
  18. */
  19. class BirthdayField extends DateField
  20. {
  21. /**
  22. * {@inheritDoc}
  23. */
  24. protected function configure()
  25. {
  26. $currentYear = date('Y');
  27. $this->addOption('years', range($currentYear-120, $currentYear));
  28. parent::configure();
  29. }
  30. }