Build forms

@param FormBuilderInterface $builder
@param array $options
10363
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $transformerStrategy = $options['transformer'];
        if ($transformerStrategy === 'auto') {
            $transformerStrategy = $options['multiple'] ? 'multiple' : 'class';
        }

        switch ($transformerStrategy) {
            case 'class':
                $builder->addViewTransformer(new ClassTransformer($this->quicklist, $options['repo']));
                break;

            case 'none':
                $builder->addViewTransformer(new NoneTransformer($this->quicklist, $options['repo']));
                break;

            case 'multiple':
                $builder->addViewTransformer(new MultipleTransformer(new ClassTransformer($this->quicklist, $options['repo'])));
                break;

            case 'multiple_none':
                $builder->addViewTransformer(new MultipleTransformer(new NoneTransformer($this->quicklist, $options['repo'])));
                break;
        }
    }
1191046
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $entityAlias = $this->entityConfiguration['alias'];
        $entityIdGetter = $this->entityConfiguration['idGetter'];

        $fieldOptions = $this
            ->formConfig
            ->getOptions();

        $fieldType = $this
            ->formConfig
            ->getType()
            ->getName();

        foreach ($this->locales as $locale) {
            $translatedFieldName = $locale . '_' . $this->fieldName;

            $entityId = $this->entity->$entityIdGetter();
            $translationData = $entityId
                ? $this
                    ->entityTranslationProvider
                    ->getTranslation(
                        $entityAlias,
                        $entityId,
                        $this->fieldName,
                        $locale
                    )
                : '';

            $builder->add($translatedFieldName, $fieldType, [
                'required' => isset($fieldOptions['required'])
                    ? $this->evaluateRequired(
                        $fieldOptions['required'],
                        $locale
                    )
                    : false,
                'mapped' => false,
                'label' => $fieldOptions['label'],
                'data' => $translationData,
                'constraints' => $fieldOptions['constraints'],
            ]);
        }
    }
1358940
public function buildForm(FormBuilderInterface $builder): FormInterface
    {
        $this->buildFilterForm($builder);
        $this->buildSortableForm($builder);

        $this->form = $builder->getForm();

        return $this->form;
    }
1008868
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->addCardType($builder, $options)
            ->addNameOnCard($builder)
            ->addHiddenInputs($builder);
    }
410440
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        /** @var AttributeInterface $attribute */
        $attribute = $options['attribute'];

        $builder
            ->add(
                'enabled',
                CheckboxType::class,
                [
                    'widget_checkbox_label' => 'label',
                ]
            )
            ->add(
                'column',
                TextType::class,
                [
                    'data' => $attribute->getCode(),
                ]
            );

        if ($attribute->getType()->isRelation()) {
            $builder->add(
                'serializedColumn',
                ChoiceType::class,
                [
                    'choices' => [
                        'EAV Identifier' => 'identifier',
                        'Doctrine Id' => 'id',
                        'Label (WARNING: not re-importable)' => 'label',
                    ],
                ]
            );
        }
    }
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');
                },
            ]);
    }
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);
    }
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));
	}
1319059
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
        $builder
            ->add('target_link', 'text', array(
                'required' => TRUE,
                'mapped' => FALSE,
                'error_bubbling' => TRUE,
                'constraints' => array(
                    new NotBlank(array('message' => 'fulgurio.lightcms.pages.add_form.target_link_is_required'))
                )
        ));
    }
870752
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->addModelTransformer($this)

            ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($builder, $options) {
                $form = $event->getForm();
                $zone = $event->getData();

                // Create a component form for each into given zone
                $form->add('components', CollectionType::class, array(
                    'auto_initialize' => false,
                    'allow_add' => false,
                    'allow_delete' => false,
                    'entry_type' => ComponentType::class,
                    'entry_options' => array(
                        'variation' => $this->variationResolver->resolve((new VariationContext())->denormalize(array(
                            'theme' => $options['theme'],
                            'content_type' => $options['content_type'],
                            'template_type' => $options['template_type'],
                            'zone_type' => $zone->getZoneType(),
                        ))),
                    ),
                ));
            })
        ;
    }
198960
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
        $builder->add('status', ChoiceType::class, [
            'label'   => 'form.page.type.status.label',
            'choices' => [
                'page.status.label.draft'       => PageStatus::DRAFT,
                'page.status.label.published'   => PageStatus::PUBLISHED,
                'page.status.label.unpublished' => PageStatus::UNPUBLISHED,
                'page.status.label.scheduled'   => PageStatus::SCHEDULED,
            ],
            'choices_as_values' => true,
        ])
        ->add('publishedAt', null, [
            'widget'             => 'single_text',
            'vic_datetimepicker' => true,
        ]);
    }
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,
                    )
                ));
            })
        ;
    }
545511
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('day_of_week_numbers', 'choice', array(
                'choices'   => DayOfWeek::getChoices(),
                'multiple'  => true,
                'expanded'  => true,
                'label'     => 'Days of Week',
            ))
            ->add('start_time', 'choice', array(
                'choices'   => WindowMaker::getStartTimeChoices(),
            ))
            ->add('end_time', 'choice', array(
                'choices'   => WindowMaker::getEndTimeChoices(),
            ))
            ->add('delivery_type', 'choice', array(
                'choices' => array(
                  HubWindow::DELIVERY_TYPE_PICKUP   => 'Pickup',
                  HubWindow::DELIVERY_TYPE_DELIVERY => 'Delivery',
                ),
                'multiple'  => false,
                'expanded'  => true,
            ))
        ;
    }
158474
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->addModelTransformer($this)
            ->add('name', TextType::class, array())
            ->add('online', ChoiceType::class, array(
                'expanded' => true,
                'multiple' => false,
                'choices' => array(
                    'Yes' => true,
                    'No' => false,
                ),
            ))
            ->add('meta', MetadataType::class, array(
                'label' => false,
                'supported_metadata' => array('title', 'description', 'keywords'),
            ))
            ->add('submit', SubmitType::class)
        ;
    }
124912
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->addWalletType($builder, $options[SubFormInterface::OPTIONS_FIELD_NAME][static::OPTION_WALLET_CHOICES]);
    }
1125078
public function buildForm(FormBuilderInterface $builder, array $options)
	{
		$builder->add('title', TextType::class, array(
			'label' => 'Post title',
			'required' => true,
			'attr' => array('class' => 'doc-title')
		))
		->add('slug', TextType::class, array(
			'label' => 'Slug',
			'required' => true,
			'attr' => array('class' => 'doc-slug')
		))
		->add('state', ChoiceType::class, array(
			'label' => 'State',
			'required' => true,
			'choices' => array(
				'Draft' => DocumentModel::STATE_DRAFT, 
				'Waiting' => DocumentModel::STATE_WAITING, 
				'Published' => DocumentModel::STATE_PUBLISHED
			),
			'preferred_choices' => array(DocumentModel::STATE_DRAFT)
		))
		->add('content', TextareaType::class, array(
			'label' => 'Content',
			'required' => false,
			'attr' => array('class' => 'tinymce-content doc-content')
		));
	}
287771
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('pageName', null, array(
            'label' => 'pages_controller_label_page_name',
        ));
        $builder->add('template', 'choice', array(
            'choices' => ChoiceValues::getTemplates($this->activeTheme, $this->themes),
            'label' => 'pages_controller_label_template',
        ));
        $builder->add('isHome', 'checkbox', array(
            'label' => 'pages_controller_label_home_page',
            'attr' => array(
                'title' => 'pages_controller_home_page_explanation',
            ),
        ));
        $builder->add('isPublished', 'checkbox', array(
            'label' => 'pages_controller_label_published',
        ));
    }