Q:

Options to subform

How i can give form's options to a subform ?
In the example below, i have the option "special" declared.
I want to access this option "special" in my subform.
My main form :
class DemandeType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('title', TextType::class, []);

        $builder->add('service_agent', ServiceType::class, [
            'mapped' => false
        ]);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'special' => true
        ]);
    }

And my subform :
class ServiceType extends AbstractType
{

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        dump($options['special']);
        $builder->add('service', TextType::class, []);

        $builder->add('agent', TextType::class, [
            'mapped' => false
        ]);
    }
    public function configureOptions(OptionsResolver $resolver)
    {
    }

A:

I answer my question.
I must declare option "special" in subform.
And this field's option is accessible in the main form.
Like that :
class DemandeType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('title', TextType::class, []);

        $builder->add('service_agent', ServiceType::class, [
            'mapped' => false,
            'special' => $options['special']
        ]);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'special' => true
        ]);
    }

And in my subform :
class ServiceType extends AbstractType
{

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        dump($options['special']); // It's OK :)
        $builder->add('service', TextType::class, []);

        $builder->add('agent', TextType::class, [
            'mapped' => false
        ]);
    }
    public function configureOptions(OptionsResolver $resolver)
    {
       $resolver->setDefaults([
            'special' => true
        ]);
    }

