@param \Symfony\Component\Form\FormBuilderInterface $builder
@param array $options

@return $this
352163
protected function addCardExpiresYear(FormBuilderInterface $builder, array $options)
    {
        $builder->add(
            self::FIELD_CARD_EXPIRES_YEAR,
            ChoiceType::class,
            [
                'label' => false,
                'choices' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_CARD_EXPIRES_CHOICES_YEAR],
                'required' => true,
                'attr' => [
                    'placeholder' => 'Expires year',
                ],
                'constraints' => [
                    $this->createNotBlankConstraint(),
                ],
            ]
        );

        return $this;
    }
158212
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        // title
        $builder->add('title', SymfonyTextType::class, array(
            'required' => false
        ));

        // headline (on demand)
        if (!empty($options['headline']['enabled'])) {
            $builder->add('headline', TextareaType::class, array(
                'required' => false
            ));
        }

        // text (rich editor or not)
        $builder->add('text', TextareaType::class, array(
            'attr' => array(
                'class' => empty($options['html']['enabled'])
                    ? 'synapse-simple-editor'
                    : 'synapse-rich-editor',
                'data-editor-config' => json_encode($options['ckeditor_config']),
            ),
        ));

        // image select (on demand)
        if (!empty($options['images'])) {
            $builder->add('images', ImageChoiceType::class, array(
                'image_formats' => $options['images']['format'],
                'required' => false,
                'expanded' => false,
                'multiple' => !empty($options['images']['multiple']),
            ));
        }

        // "Read more" link (on demand)
        if (!empty($options['read_more']['enabled'])) {
            $builder
                ->add('link', SymfonyTextType::class, array(
                    'required' => false,
                ))
                ->add('link_label', SymfonyTextType::class, array(
                    'required' => false,
                ))
            ;
        }
    }
455494
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $hierarchy = $options['hierarchy'];
        $builder->addEventListener(
            FormEvents::PRE_SET_DATA,
            function (FormEvent $event) use ($hierarchy) {
                $roles = $event->getData();
                $form = $event->getForm();

                if ($hierarchy instanceof LeafRole) {
                    $options = [
                        'label' => $hierarchy->getRole(),
                        'required' => false,
                        'widget_checkbox_label' => 'widget',
                    ];
                    if (\is_array($roles)) {
                        /** @var array $roles */
                        foreach ($roles as $role) {
                            if ($role === $hierarchy->getRole()) {
                                unset($roles[$role]);
                                $options['data'] = true;
                            }
                        }
                    }
                    $form->add('hasRole', CheckboxType::class, $options);
                    $hierarchy = $hierarchy->getChildren();
                }
                /** @var Role[] $hierarchy */
                foreach ($hierarchy as $subRole) {
                    $form->add(
                        $subRole->getRole(),
                        self::class,
                        [
                            'hierarchy' => $subRole,
                            'label' => false,
                            'data' => $roles,
                        ]
                    );
                }
            }
        );

        $builder->addModelTransformer(
            new CallbackTransformer(
                function ($originalData) {
                    // Delete original data:
                    return null;
                },
                function ($submittedData) use ($hierarchy) {
                    if ($hierarchy instanceof LeafRole) {
                        if ($submittedData['hasRole']) {
                            $submittedData[] = $hierarchy->getRole();
                        }
                        unset($submittedData['hasRole']);
                    }
                    /** @var array $submittedData */
                    foreach ($submittedData as $key => $items) {
                        if (\is_array($items)) {
                            unset($submittedData[$key]);
                            /** @var array $items */
                            foreach ($items as $role) {
                                $submittedData[] = $role;
                            }
                        }
                    }

                    return $submittedData;
                }
            )
        );
    }
43352
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($options['as_collection']) {
            $builder->addModelTransformer(new CallbackTransformer(
                function ($original) {
                    $ids = [];
                    foreach ($original as $content) {
                        $ids[] = $content->getId();
                    }

                    return json_encode($ids);
                },
                function ($submitted) {
                    $array = json_decode($submitted, true);

                    $ids = [];
                    foreach ($array as $item) {
                        $ids[] = $item['id'];
                    }

                    return $this->contentManager->getRepository()->findByIds($ids);
                }
            ));
        } else {
            $builder->addModelTransformer(new CallbackTransformer(
                function ($original) {
                    return $original;
                },
                function ($submitted) {
                    $array = json_decode($submitted, true);

                    $ids = [];
                    foreach ($array as $item) {
                        $ids[] = $item['id'];
                    }

                    return json_encode($ids);
                }
            ));
        }
    }
124912
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->addWalletType($builder, $options[SubFormInterface::OPTIONS_FIELD_NAME][static::OPTION_WALLET_CHOICES]);
    }
689170
protected function addRoles(FormBuilderInterface $builder, array $options = [])
    {
        $builder
            ->add(
                'roles',
                ChoiceType::class,
                [
                    'label'             => Trans::__('page.edit-users.label.assigned-roles'),
                    'multiple'          => true,
                    'required'          => false,
                    'expanded'          => true,
                    'choices_as_values' => true,
                    'choices'           => $options['choices'],
                    'choice_attr'       => function ($val) use ($options) {
                        return Bag::from($options['mutable'])->hasItem($val) ? [] : ['disabled' => 'disabled'];
                    },
                ]
            )
        ;

        return $this;
    }
1129775
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->entityProxyFieldsBuilder->buildForEntityAndWidgetType($builder, $options['widget'], $options['namespace']);
    }
1152797
public function buildForm(FormBuilderInterface $builder, array $options)
	{
		$builder->add('name', TextType::class, array(
			'label' => 'Parameter name',
			'required' => true
		))
		->add('value', TextType::class, array(
			'label' => 'Parameter value',
			'required' => true,
		));
		
		$builder->add('config', HiddenType::class, array(
			'required' => true
		));
		
		$builder->get('config')->addModelTransformer(new IdToConfigTransformer($this->configManager));
	}
1137900
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($this->getParent() === 'hidden') {
            $builder->addModelTransformer($this->transformer);
        }
    }
898690
public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('name')
            ->add('image', MediaType::class, [
                'translation_domain' => BkstgCoreBundle::TRANSLATION_DOMAIN,
                'provider' => 'sonata.media.provider.image',
                'context' => 'default',
            ])
            ->add('banner', MediaType::class, [
                'translation_domain' => BkstgCoreBundle::TRANSLATION_DOMAIN,
                'provider' => 'sonata.media.provider.image',
                'context' => 'default',
            ])
            ->add('description', CKEditorType::class, [
                'required' => false,
                'config' => ['toolbar' => 'basic'],
            ])
            ->add('active', ChoiceType::class, [
                'label' => 'production.form.status',
                'choices' => [
                    'production.form.status_choices.active' => true,
                    'production.form.status_choices.closed' => false,
                ],
            ])
            ->add('expiry', DateTimeType::class, [
                'date_widget' => 'single_text',
                'time_widget' => 'single_text',
                'required' => false,
            ])
        ;
    }
701458
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if($this->view == 'read_only'){
            $readOnly = true;
        } else {
            $readOnly = false;
        }

        $builder->add('name', 'text', array(
            'label' => 'Name',
//            'data' => $options['data']->getName(),
            'read_only' => $readOnly,
        ));

        if($this->view != 'hide_url'){
            $builder->add('URL', 'url', array(
                'label' => 'URL',
//                'data' => $options['data']->getUrl(),
                'read_only' => $readOnly,
            ));
        }

        if($this->view == 'checkbox'){
            $builder->add('selected', 'checkbox', array(
                'label'     => 'Add "'.$options['data']->getName().'" as location',
                'required'  => true,
                'data' => true,
                'mapped' => false,
                'attr' => array(
                    'align_with_widget' => true,
                ),
            ));
        }

        $hookListener = $this->getHookListener($builder);

        // Embed hook forms.
        $builder->addEventSubscriber($hookListener);
    }
1044337
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('quantity', 'choice', array(
                'choices' => $this->product->getAddToCartQuantities(),
                'data'    => $this->quantity ? $this->quantity : 1,
            ))
        ;
    }
608462
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($options['encryption_profile'] === false) {
            return;
        }
        
        $builder->addModelTransformer(new EncryptTransformer(
            $this->cipherTextGenerator,
            $options['encryption_profile']
        ));
    }
1183435
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add(
                self::START_NAME,
                DatePickerType::class,
                [
                    'widget_position' => 'left',
                    'attr' => [
                        'class' => 'input-sm form-control',
                        'placeholder' => 'sidus.filter.date_range.start_date',
                    ],
                ]
            )
            ->add(
                self::END_NAME,
                DatePickerType::class,
                [
                    'attr' => [
                        'class' => 'input-sm form-control',
                        'placeholder' => 'sidus.filter.date_range.end_date',
                    ],
                ]
            );
    }
439466
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        foreach ($options['button_groups'] as $name => $config) {
            $builder->add($name, ButtonGroupType::class, $config);
        }
    }
1325525
protected function addBankGroupType(FormBuilderInterface $builder, array $options)
    {
        $builder->add(
            static::FIELD_BANK_GROUP_TYPE,
            ChoiceType::class,
            [
                'label' => false,
                'required' => true,
                'expanded' => false,
                'multiple' => false,
                'placeholder' => false,
                'choices' => $options[static::OPTIONS_FIELD_NAME][static::OPTION_BANK_GROUP_TYPES],
                'constraints' => [],
            ]
        );

        return $this;
    }
381202
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $builder->remove('translations');
        $builder->add('translations', TranslationsType::class, [
            'required_locales' => [],
            'fields'           => [
                'name' => [
                    'label'                        => 'form.view.type.name.label',
                    'vic_business_properties'      => $options['vic_business_properties'],
                    'vic_business_property_picker' => [
                        'description' => 'victoire.form.business_template.name.vic_business_property_picker',
                    ],
                ],
                'slug' => [
                    'label'                        => 'victoire.form.business_template.slug.label',
                    'vic_business_properties'      => $options['vic_business_properties'],
                    'vic_business_property_picker' => [
                        'description' => 'victoire.form.business_template.slug.vic_business_property_picker',
                    ],
                ],
            ],
        ]);
        $builder
            ->add('backendName', null, [
                'label'          => 'victoire.form.business_template.backend_name.label',
                'vic_help_block' => 'victoire.form.business_template.backend_name.help_block',
            ])
            ->add('query', null, [
                'label'                        => 'victoire.form.business_template.query.label',
                'vic_business_properties'      => $options['vic_business_properties'],
                'vic_business_property_picker' => [
                    'description' => false,
                ],
            ])
            ->add('businessEntityId', HiddenType::class);
    }