CollectionType.php 1004 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project 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. namespace Sonata\AdminBundle\Form\Type;
  11. use Symfony\Component\Form\AbstractType;
  12. /**
  13. * This type wrap native `collection` form type and render `add` and `delete`
  14. * buttons in standard Symfony` collection form type.
  15. *
  16. * @author Andrej Hudec <pulzarraider@gmail.com>
  17. */
  18. class CollectionType extends AbstractType
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function getParent()
  24. {
  25. return 'collection';
  26. }
  27. /**
  28. * {@inheritdoc}
  29. *
  30. * @todo Remove when dropping Symfony <2.8 support
  31. */
  32. public function getName()
  33. {
  34. return $this->getBlockPrefix();
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function getBlockPrefix()
  40. {
  41. return 'sonata_type_native_collection';
  42. }
  43. }