@param FormBuilderInterface $builder
@param array                $options

@throws AlreadySubmittedException
@throws LogicException
@throws UnexpectedTypeException
@throws \InvalidArgumentException
510757
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add(
            'family',
            FamilySelectorType::class,
            [
                'label' => false,
                'families' => $options['allowed_families'],
                'placeholder' => 'sidus.family.selector.placeholder',
            ]
        );
        $builder->addEventListener(
            FormEvents::PRE_SET_DATA,
            function (FormEvent $event) use ($options) {
                $form = $event->getForm();
                /** @var DataInterface $data */
                $data = $event->getData();

                /** @var FamilyInterface[] $families */
                $families = $options['allowed_families'];
                foreach ($families as $family) {
                    $selected = false;
                    if ($data instanceof DataInterface) {
                        $selected = $family->getCode() === $data->getFamilyCode();
                    }
                    $form->add(
                        'data_'.$family->getCode(),
                        AutocompleteDataSelectorType::class,
                        [
                            'label' => false,
                            'allowed_families' => [$family],
                            'auto_init' => $selected,
                            'attr' => [
                                'data-family' => $family->getCode(),
                                'style' => 'display:none',
                            ],
                        ]
                    );
                }
            }
        );

        $builder->addModelTransformer(
            new CallbackTransformer(
                function ($originalData) {
                    if ($originalData instanceof DataInterface) {
                        return [
                            'family' => $originalData->getFamily(),
                            'data_'.$originalData->getFamilyCode() => $originalData,
                        ];
                    }

                    return $originalData;
                },
                function ($submittedData) {
                    $family = $submittedData['family'];
                    if ($family instanceof FamilyInterface) {
                        return $submittedData['data_'.$family->getCode()];
                    }

                    return null;
                }
            )
        );
    }
970325
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('data', CollectionType::class, array(
                'entry_type' => PageMenuItemType::class,
                'allow_add' => true,
                'allow_delete' => true,
                'attr' => [
                    'class' => 'synapse-page-menu-data',
                ],
            ))
        ;
    }
322199
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $locale = $this->requestStack->getCurrentRequest()->getLocale();

        //add the link to the business entity instance
        //it depends of the form
        $builder
            ->add($options['business_entity_id'], EntityType::class, [
                'label'       => false,
                'required'    => false,
                'placeholder' => 'entity_proxy.form.empty_value',
                'class'       => $options['namespace'],
                'attr'        => [
                    'class' => 'add_'.$options['business_entity_id'].'_link picker_entity_select',
                ],
                'query_builder' => function (EntityRepository $er) use ($options, $locale) {
                    // Don't display entities that don't have translations in the current locale.
                    if (in_array(Translatable::class, class_uses($options['namespace']))) {
                        return $er->createQueryBuilder('entity')
                            ->join('entity.translations', 't')
                            ->andWhere('t.locale = :s')
                            ->setParameter(':s', $locale);
                    }

                    return $er->createQueryBuilder('entity');
                },
            ]);
    }
755251
public function buildValuesForm(FormBuilderInterface $builder, array $options = [])
    {
        /** @var FamilyInterface $family */
        $family = $options['family'];

        $attributes = $family->getAttributes();
        if ($options['attributes_config']) {
            if (!$options['merge_attributes_config']) {
                $attributes = [];
            }
            foreach (array_keys($options['attributes_config']) as $attributeCode) {
                $attributes[$attributeCode] = $family->getAttribute($attributeCode);
            }
        }

        foreach ($attributes as $attribute) {
            $this->attributeFormBuilder->addAttribute(
                $builder,
                $attribute,
                $this->resolveAttributeConfig($attribute, $options)
            );
        }
    }
400125
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->getFormFieldsExtended($builder, $options, 'extendedField');
        $this->getFormFieldsExtended($builder, $options, 'extendedFieldSecure');
    }
97467
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->addModelTransformer($this)
            ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($builder, $options) {
                $form = $event->getForm();
                $data = array(
                    'template_types' => null,
                    'templates' => array(),
                );

                // "templates"  field
                $templateFormBuilder = $builder->create('templates', null, array(
                    'compound' => true,
                    'auto_initialize' => false,
                ));
                $templateTypeChoices = array();

                // every template type got his own form
                foreach ($options['theme']->getTemplateTypes() as $templateType) {

                    // variation calculation
                    $variation = $this->variationResolver->resolve((new VariationContext())->denormalize(array(
                        'theme' => $options['theme'],
                        'content_type' => $contentType = $options['content_type'],
                        'template_type' => $templateType,
                    )));
                    if (!$templateType->supportsContentType(
                        $contentType->getName(),
                        $variation->getConfiguration('templates', $templateType->getName(), 'contents', array())
                    )) {
                        continue;
                    }

                    // template select entry
                    $templateTypeChoices[$templateType->getId()] = $templateType;

                    // template form construction
                    $template = $options['content']
                        ? $this->templateLoader->retrieveLocal($templateType, $options['content'])
                        : $this->templateLoader->retrieveGlobal($templateType, $contentType)
                    ;
                    if (!$template) {  // no template to edit : nothing to do
                        continue;
                    }

                    $data['templates'][$templateType->getName()] = $template;

                    $templateFormBuilder->add($templateType->getName(), TemplateType::class, array(
                        'auto_initialize' => false,
                        'content_type' => $options['content_type'],
                        'theme' => $options['theme'],
                        'template_type' => $templateType,
                        'variation' => $variation,
                    ));
                }

                $form
                    ->add('template_types', ChoiceType::class, array(
                        'required' => true,
                        'expanded' => false,
                        'auto_initialize' => false,
                        'choices' => $templateTypeChoices,
                        'mapped' => false,
                        'choice_value' => 'name',
                        'choice_label' => 'name',
                    ))
                    ->add($templateFormBuilder->getForm())
                ;

                $event->setData($data);
            })
        ;
    }
610578
public function buildForm(FormBuilderInterface $builder, array $options)
	{
		$builder->add('name', TextType::class, array(
			'label' => 'Config name',
			'required' => true
		))
		->add('alias', TextType::class, array(
			'label' => 'Alias (interal use)',
			'required' => true 
		))
		->add('parameters', BaseCollectionType::class, array(
			'entry_type' => ParameterType::class,
			'label' => 'List of parameters',
			'allow_add' => true,
			'allow_delete' => true,
			'prototype' => true,
			'containerId' => 'parameters-collection'
		))
		->add('isDefault', CheckboxType::class, array(
			'label' => 'Configuration par défaut'
		));
	}
104750
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('expression', TextType::class, [
                'required' => true,
                'constraints' => [new ExpressionConstraint()],
            ])
            ->add('arguments', TextType::class, [
                'required' => false,
                'constraints' => [new ArgumentsConstraint()],
            ])
            ->add('priority', IntegerType::class, [
                'required' => true,
            ])
            ->add('enabled', CheckboxType::class, [
                'required' => false,
            ])
            ->add('update', SubmitType::class, [
                'label' => /** @Desc("Update") */
                    'cron_update_form.update',
            ]);
    }
94788
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->addModelTransformer($this)
            ->add('name', TextType::class)
            ->add('title', TextType::class)
            ->add('path', TextType::class, array(
                'required' => false,
            ))
            ->add('parent', ChoiceType::class, array(
                'required' => true,
                'choices' => $this->pageLoader->retrieveAll(),
                'choice_label' => function (Page $page) {
                    return sprintf('%s (/%s)', $page->getName(), $page->getPath());
                },
            ))
            ->add('submit', SubmitType::class)
        ;
    }
550003
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('x', NumberType::class, array())
            ->add('y', NumberType::class, array())
            ->add('width', NumberType::class, array())
            ->add('height', NumberType::class, array())
            ->add('rotate', NumberType::class, array())
            ->add('scaleX', NumberType::class, array())
            ->add('scaleY', NumberType::class, array())
        ;
    }
971538
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('richs', CollectionType::class, [
            'entry_type' => WidgetRichListItemType::class,
            'allow_add' => true,
            'allow_delete' => true,
            'by_reference' => false,
            'entry_options' => [
                'namespace'        => $options['namespace'],
                'businessEntityId' => $options['businessEntityId'],
                'widget'           => $options['widget'],
            ],
            'attr' => ['id' => 'static'],
        ]);

        //add the mode to the form
        $builder->add('mode', HiddenType::class, [
            'data' => $options['mode'],
        ]);

        //add the slot to the form
        $builder->add('slot', HiddenType::class, []);
        $this->addCriteriasFields($builder, $options);

        $builder->add('quantum', QuantumType::class, [
            'label'    => 'victoire.widget.type.quantum.label',
            'attr'     => [
                'data-flag' => 'v-quantum-name',
            ],
        ]);
    }
174767
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $this->addBankGroupType($builder, $options);
    }
1241367
public function buildForm (FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name', 'text', array(
                'label' => 'Nom du groupe'
            ))
            ->add('roles', 'choice', array(
                'label' => 'Rôles',
                'choices' => $this->getRoles(),
                'multiple' => true,
                'expanded' => true
            ))
            ->add('users', 'olix_doublelist_entity', array(
                'label' => 'Utilisateurs',
                'class' => 'OlixSecurityBundle:User',
                'property' => 'name',
                'mapped' => false
            ))
        ;
    }
244458
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add(
            '__tab_main',
            TabType::class,
            [
                'label' => 'admin.user.tab.main.label',
                'inherit_data' => true,
            ]
        );
        /** @var FormBuilderInterface $mainTab */
        $mainTab = $builder->get('__tab_main');
        $mainTab
            ->add(
                'username',
                TextType::class,
                [
                    'label' => 'admin.user.form.username.label',
                ]
            )
            ->add(
                'email',
                EmailType::class,
                [
                    'label' => 'admin.user.form.email.label',
                ]
            );

        if ($this->getUser() && $this->authorizationChecker->isGranted('ROLE_ADMIN', $this->getUser())) {
            $mainTab
                ->add(
                    'enabled',
                    SwitchType::class,
                    [
                        'label' => 'admin.user.form.enabled.label',
                    ]
                )
                ->add(
                    'rawRoles',
                    RoleHierarchyType::class,
                    [
                        'label' => 'admin.user.form.roles.label',
                    ]
                )
                ->add(
                    'familyPermissions',
                    BootstrapCollectionType::class,
                    [
                        'label' => 'admin.user.form.familyPermissions.label',
                        'entry_type' => FamilyPermissionType::class,
                        'entry_options' => [],
                        'allow_add' => true,
                        'allow_delete' => true,
                        'required' => false,
                        'sortable' => false,
                        'by_reference' => false,
                    ]
                );

            $builder->add(
                '__tab_groups',
                TabType::class,
                [
                    'label' => 'admin.user.tab.groups.label',
                    'inherit_data' => true,
                ]
            );
            /** @var FormBuilderInterface $groupsTab */
            $groupsTab = $builder->get('__tab_groups');
            $groupsTab
                ->add(
                    'groups',
                    EntityType::class,
                    [
                        'label' => 'admin.user.form.groups.label',
                        'class' => Group::class,
                        'expanded' => true,
                        'multiple' => true,
                    ]
                );
        }

        $builder->add(
            '__tab_info',
            TabType::class,
            [
                'label' => 'admin.user.tab.info.label',
                'inherit_data' => true,
            ]
        );
        // Add EAV data edition
        $this->buildDataForm($builder);

        $builder->addEventListener(
            FormEvents::POST_SUBMIT,
            function (FormEvent $event) {
                /** @var User $user */
                $user = $event->getData();
                if ($user) {
                    $user->setUpdatedAt(new \DateTime());
                }
            }
        );
    }
284392
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($options['businessEntityId'] !== null) {
            if ($options['namespace'] === null) {
                throw new \Exception('The namespace is mandatory if the business_entity_id is given.');
            }
            if ($options['mode'] === null) {
                throw new \Exception('The mode is mandatory if the business_entity_id is given.');
            }
        }

        if ($options['mode'] === Widget::MODE_ENTITY) {
            $this->addEntityFields($builder, $options);
        }

        if ($options['mode'] === Widget::MODE_QUERY) {
            $this->addQueryFields($builder, $options);
        }

        if ($options['mode'] === Widget::MODE_BUSINESS_ENTITY) {
            $this->addBusinessEntityFields($builder, $options);
        }

        //add the mode to the form
        $builder->add('mode', HiddenType::class, [
            'data' => $options['mode'],
        ]);
        $builder->add('asynchronous', HiddenType::class);
        $builder->add('theme', HiddenType::class);
        $builder->add('quantum', QuantumType::class, [
            'label' => 'victoire.widget.type.quantum.label',
            'attr'  => [
                'data-flag' => 'v-quantum-name',
            ],
        ]);

        //add the slot to the form
        $builder->add('slot', HiddenType::class, []);

        $this->addCriteriasFields($builder, $options);
        //we use the PRE_SUBMIT event to set the mode option
        $builder->addEventListener(
            FormEvents::PRE_SUBMIT,
            function (FormEvent $event) use ($options) {
                //we get the raw data for the widget form
                $rawData = $event->getData();

                //get the posted mode
                $mode = $rawData['mode'];

                //get the form to add more fields
                $form = $event->getForm();

                //the controller does not use the mode to construct the form, so we update it automatically
                if ($mode === Widget::MODE_ENTITY) {
                    $this->addEntityFields($form, $options);
                }

                if ($mode === Widget::MODE_QUERY) {
                    $this->addQueryFields($form, $options);
                }
                if ($mode === Widget::MODE_BUSINESS_ENTITY) {
                    $this->addBusinessEntityFields($form, $options);
                }
            }
        );
    }
376653
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->addModelTransformer($this)
            ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($builder, $options) {
                $form = $event->getForm();
                $component = $event->getData();

                // Adds custom "data" component from component type
                $form->add('data', $component->getComponentType()->getFormType(), array_replace_recursive(
                    $options['variation']->getConfiguration(
                        'components',
                        $component->getComponentType()->getName(),
                        'config',
                        array()
                    ),
                    array(
                        'auto_initialize' => false,
                        'label' => false,
                    )
                ));
            })
        ;
    }
856035
public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $this->assertOptionsAreValid($options);

        foreach ($options['options'] as $i => $option) {
            if (!$option instanceof ProductOptionInterface) {
                throw new InvalidConfigurationException(
                    sprintf('Each object passed as option list must implement "%s"', ProductOptionInterface::class)
                );
            }

            $builder->add((string) $option->getCode(), ProductOptionValueChoiceType::class, [
                'label' => $option->getName() ?: $option->getCode(),
                'option' => $option,
                'property_path' => '[' . $i . ']',
                'block_name' => 'entry',
            ]);
        }
    }