TextField.php 853 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Symfony\Component\Form;
  3. /*
  4. * This file is part of the Symfony framework.
  5. *
  6. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  7. *
  8. * This source file is subject to the MIT license that is bundled
  9. * with this source code in the file LICENSE.
  10. */
  11. /**
  12. * A text input field.
  13. *
  14. * @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
  15. */
  16. class TextField extends InputField
  17. {
  18. /**
  19. * {@inheritDoc}
  20. */
  21. protected function configure()
  22. {
  23. parent::configure();
  24. $this->addOption('max_length');
  25. }
  26. /**
  27. * {@inheritDoc}
  28. */
  29. public function render(array $attributes = array())
  30. {
  31. return parent::render(array_merge(array(
  32. 'type' => 'text',
  33. 'maxlength' => $this->getOption('max_length'),
  34. ), $attributes));
  35. }
  36. }