define form fields.

@param FormBuilderInterface $builder

@param array $options
338167
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
        $builder->add('title', null, [
                'label'    => 'widget_richlist.form.title.label',
                'required' => true,
            ])
            ->add('description', TextareaType::class, [
                'label'    => 'widget_richlist.form.description.label',
                'required' => true,
            ])
            ->add('kind', null, [
                'label'    => 'widget_richlist.form.kind.label',
                'required' => true,
            ])
            ->add('image', MediaType::class, [
                'label'    => 'widget_richlist.form.image.label',
                'required' => false, ])
            ->add('image2', MediaType::class, [
                'label'    => 'widget_richlist.form.image2.label',
                'required' => false, ])
            ->add('link', LinkType::class)
            ->add('linkLabel', null, [
                'label'    => 'form.widget_richlist.linkLabel.label',
                'required' => false,
            ])
            ->add('linkEnabled', CheckboxType::class, [
                    'label'    => 'form.widget_richlist.linkEnabled.label',
                    'required' => false,
                    'attr'     => [
                        'onchange' => 'linkEnable($vic(this).is(\':checked\']);',
                    ],
            ]);
    }
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)
        ;
    }
1105739
public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $resource = $options['data'];
        $builder
            ->add('media', MediaType::class, [
                'label' => 'resource.form.file',
                'provider' => 'sonata.media.provider.file',
                'context' => 'default',
                'translation_domain' => BkstgResourceBundle::TRANSLATION_DOMAIN,
            ])
            ->add('name', TextType::class, [
                'label' => 'resource.form.name',
            ])
            ->add('description', CKEditorType::class, [
                'label' => 'resource.form.description',
                'config' => ['toolbar' => 'basic'],
                'required' => false,
            ])
            ->add('active', ChoiceType::class, [
                    // Show "unpublished" instead of active.
                    'choice_loader' => new CallbackChoiceLoader(function () use ($resource) {
                        yield 'resource.form.status_choices.active' => true;
                        if (!$resource->isPublished()) {
                            yield 'resource.form.status_choices.unpublished' => false;
                        } else {
                            yield 'resource.form.status_choices.archived' => false;
                        }
                    }),
                    'label' => 'resource.form.status',
            ])
            ->add('pinned', CheckboxType::class, [
                'label' => 'resource.form.pinned',
                'required' => false,
            ])
        ;
    }
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',
                    ],
                ]
            );
        }
    }
124912
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->addWalletType($builder, $options[SubFormInterface::OPTIONS_FIELD_NAME][static::OPTION_WALLET_CHOICES]);
    }
1032163
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $builder->add(
            '__tab_password',
            TabType::class,
            [
                'label' => 'admin.user.tab.password.label',
                'inherit_data' => true,
            ]
        );
        /** @var FormBuilderInterface $passwordTab */
        $passwordTab = $builder->get('__tab_password');
        $passwordTab
            ->add(
                'plainPassword',
                RepeatedType::class,
                [
                    'type' => PasswordType::class,
                    'first_options' => ['label' => 'admin.user.form.password.label'],
                    'second_options' => ['label' => 'admin.user.form.repeat_password.label'],
                ]
            );
    }
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'
		));
	}
846973
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
        $form_options = $builder->get('value')->getOptions();
        if ($form_options['multiple']) {
            $builder->get('value')->addModelTransformer(new StringToArrayTransformer(','));
        }
    }
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',
            ]);
        }
    }
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',
        ));
    }
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'],
            ]);
        }
    }
479314
public function buildForm (FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
        // Conserve que le champ mot de passe
        foreach (array_keys($builder->all()) as $name) {
            if ($name != 'plainPassword') $builder->remove($name);
        }
    }
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',
                ],
            ))
        ;
    }
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(),
                        ))),
                    ),
                ));
            })
        ;
    }
384462
public function addTextField(FormBuilderInterface $builder, string $name, array $options)
    {
        $builder->add(
            strtolower($name),
            TextType::class,
            array_merge_recursive(array("required" => false), $options)
        );

        return $this;
    }
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);
            })
        ;
    }
908413
public function buildForm(FormBuilderInterface &$builder, array $options, array $data)
    {
        $this->addStandardFormFields('contactsource', 'categories', $builder, $data);
        $this->addExtendedFormFields('contactsource', 'items', $builder, $data);
        //This is in anticipation of PR 5995 getting merged ~2.16
        if (method_exists($this, 'addCustomFormFields')) {
            $addCustomFormFields = 'addCustomFormFields';
            $this->$addCustomFormFields($this->getName(), 'export', $builder, 'mautic.core.permissions.export', ['disable' => 'mautic.core.permissions.disable'], $data);
        }
    }