ImmutableArrayType.php 947 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. *
  10. */
  11. namespace Sonata\AdminBundle\Form\Type;
  12. use Symfony\Component\Form\AbstractType;
  13. use Symfony\Component\Form\FormBuilder;
  14. use Sonata\AdminBundle\Form\EventListener\ResizeFormListener;
  15. class ImmutableArrayType extends AbstractType
  16. {
  17. public function buildForm(FormBuilder $builder, array $options)
  18. {
  19. foreach($options['keys'] as $infos) {
  20. list($name, $type, $options) = $infos;
  21. $builder->add($name, $type, $options);
  22. }
  23. }
  24. public function getDefaultOptions(array $options)
  25. {
  26. return array(
  27. 'keys' => array(),
  28. );
  29. }
  30. public function getName()
  31. {
  32. return 'sonata_type_immutable_array';
  33. }
  34. }