My collection is made of this type
<?php namespace Gustaw\AdminBundle\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class AttributeValueType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('value') ->add('translations', 'a2lix_translations'); } public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'Gustaw\AdminBundle\Entity\AttributeValue', 'label' => false, )); } public function getName() { return 'attribute_value_type'; } }
And this is my form
public function configureFormFields(FormMapper $formMapper) { $formMapper->with('General') ->add('name', null, array('required' => true)) ->add('translations', 'a2lix_translations', array( 'by_reference' => false, 'fields' => array( 'name' => array() ) )) ->add('custom', null, array( 'required' => false, )) ->add('category', 'entity', array( 'required' => true, 'class' => 'GustawAdminBundle:Category', 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('c') ->orderBy('c.root', 'ASC') ->addOrderBy('c.lft', 'ASC'); },)) ->end() ->with('Values')
The problem is adding new items to the collection. Each individual AttributeValueType attribute gets the label "__name__label__ *" when I do not want to have a label for this field, as I set it to false.
I tried setting "prototype_name", hoping that this would change something, only to make things worse.
The only ideas that came to my mind:
1st - create a custom untagged theme only for this collection 2nd - change base.js in SonataAdminBundle
2nd is obviously not a good option, so I only stay with the first one.
Question: are there any other options that I have?