@param FormBuilderInterface $builder
@param array                $options

@return AbstractUserType
505869
protected function addLastIp(FormBuilderInterface $builder, array $options = [])
    {
        $builder
            ->add(
                'lastip',
                TextType::class,
                [
                    'disabled' => true,
                    'label'    => Trans::__('page.edit-users.label.last-ip'),
                ] + $options
            )
        ;

        return $this;
    }
1167366
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        foreach ($options['supported_metadata'] as $metaName) {
            $builder->add($metaName, TextareaType::class, array(
                'required' => false,
            ));
        }
    }
1137900
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($this->getParent() === 'hidden') {
            $builder->addModelTransformer($this->transformer);
        }
    }
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',
            ]);
    }
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');
                },
            ]);
    }
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)
        ;
    }
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;
    }
55558
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $choices = array(
            'LIKE %...%' => AbstractQueryBuilder::OPERATOR_CONTAINS,
            '=' => AbstractQueryBuilder::OPERATOR_EQUALS,
        );
        if ($options['addNullTransformer']) {
            $choices['IS NULL'] = AbstractQueryBuilder::OPERATOR_IS_NULL;
            $choices['IS NOT NULL'] = AbstractQueryBuilder::OPERATOR_IS_NOT_NULL;
        }
        $builder
            ->add('transformer', ChoiceType::class, array_merge(array(
                'choices' => $choices,
            ), $options['transformerOptions']))
            ->add('value', TextType::class, array_merge(array(
                'required' => false,
            ), $options['valueOptions']));
    }
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')
		));
	}
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;
    }
289586
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($this->widget === 'ajax' && $options['multiple'] === true){
            $builder->addViewTransformer($this->transformer);
        }
    }
400125
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->getFormFieldsExtended($builder, $options, 'extendedField');
        $this->getFormFieldsExtended($builder, $options, 'extendedFieldSecure');
    }
431201
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('query', CoreSearchType::class, ['required' => false])
            ->add('page', HiddenType::class)
            ->add('limit', HiddenType::class)
            ->add('content_types', ContentTypeChoiceType::class, [
                'multiple' => true,
                'expanded' => true,
            ])
            ->add('last_modified', DateIntervalType::class)
            ->add('created', DateIntervalType::class)
            ->add('creator', UserType::class)
            ->add('last_modified_select', ChoiceType::class, [
                'choices' => $this->getTimePeriodChoices(),
                'required' => false,
                'placeholder' => /** @Desc("Any time") */ 'search.any_time',
                'mapped' => false,
            ])
            ->add('created_select', ChoiceType::class, [
                'choices' => $this->getTimePeriodChoices(),
                'required' => false,
                'placeholder' => /** @Desc("Any time") */ 'search.any_time',
                'mapped' => false,
            ])
            ->add('subtree', HiddenType::class, [
                'required' => false,
            ])
        ;

        if ($this->permissionResolver->hasAccess('section', 'view')) {
            $builder->add('section', SectionChoiceType::class, [
                'required' => false,
                'multiple' => false,
                'placeholder' => /** @Desc("Any section") */ 'search.section.any',
            ]);
        }
    }
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,
                ))
            ;
        }
    }
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);
                }
            ));
        }
    }
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',
                    ],
                ]
            );
    }
1023305
protected function addDisplayName(FormBuilderInterface $builder, array $options = [])
    {
        $builder
            ->add(
                'displayname',
                TextType::class,
                [
                    'label' => Trans::__('page.edit-users.label.display-name'),
                    'attr'  => [
                        'placeholder' => Trans::__('page.edit-users.placeholder.displayname'),
                    ],
                    'constraints' => [
                        new Assert\NotBlank(),
                        new Assert\Length(['min' => 3, 'max' => 32]),
                        new UsersAssert\ExistingEntity([
                            'className'  => Entity\Users::class,
                            'fieldNames' => ['displayname'],
                            'message'    => Trans::__('page.edit-users.error.displayname-used'),
                        ]),
                    ],
                ] + $options
            )
        ;

        return $this;
    }