Purzynski
Purzynski

Reputation: 1227

Symfony2 remove subform label

I have created a subform like on Symfony2 documentation page: http://symfony.com/doc/2.0/book/forms.html#form-rendering-template

This code:

public function buildForm(FormBuilder $builder, array $options)
{
    // ...

    $builder->add('category', new CategoryType());
}

It`s simply assign subform Category in form Task. My problem is to see subform name. I want to remove it but I do not now how to do it. I try this, but it doesn't work:

public function buildForm(FormBuilder $builder, array $options)
{
    // ...

    $builder->add('category', new CategoryType(), array('label' => '');
}

Do you have any idea how can I remove this SubForm label?

Upvotes: 2

Views: 821

Answers (1)

Purzynski
Purzynski

Reputation: 1227

I have assigned false to the label, and it works. But I am not sure is this good solution. If you have any better idea share it please/

public function buildForm(FormBuilder $builder, array $options)
{
    // ...

    $builder->add('category', new CategoryType(), array('label' => false);
}

Upvotes: 7

Related Questions