Add a custom 'object' type to write to a corresponding table for that new custom value.

@param FormBuilderInterface $builder
@param array                $options
162881
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $specialFields = [
            'dateAdded'      => 'mautic.lead.import.label.dateAdded',
            'createdByUser'  => 'mautic.lead.import.label.createdByUser',
            'dateModified'   => 'mautic.lead.import.label.dateModified',
            'modifiedByUser' => 'mautic.lead.import.label.modifiedByUser',
            'lastActive'     => 'mautic.lead.import.label.lastActive',
            'dateIdentified' => 'mautic.lead.import.label.dateIdentified',
            'ip'             => 'mautic.lead.import.label.ip',
            'points'         => 'mautic.lead.import.label.points',
            'stage'          => 'mautic.lead.import.label.stage',
            'doNotEmail'     => 'mautic.lead.import.label.doNotEmail',
            'ownerusername'  => 'mautic.lead.import.label.ownerusername',
        ];

        $utmFields = [
            'utm_campaign' => 'mautic.lead.field.utmcampaign',
            'utm_content'  => 'mautic.lead.field.utmcontent',
            'utm_medium'   => 'mautic.lead.field.utmmedium',
            'utm_term'     => 'mautic.lead.field.utmterm',
        ];

        $importChoiceFields = [
            'mautic.contactsource.choice.utmtags' => $utmFields,
            'mautic.lead.contact'                 => $options['lead_fields'],
            'mautic.lead.company'                 => $options['company_fields'],
            'mautic.lead.special_fields'          => $specialFields,
        ];

        if ('lead' !== $options['object']) {
            unset($importChoiceFields['mautic.lead.contact']);
        }

        foreach ($options['import_fields'] as $field => $label) {
            $builder->add(
                $field,
                'choice',
                [
                    'choices'    => $importChoiceFields,
                    'label'      => $label,
                    'required'   => false,
                    'label_attr' => ['class' => 'control-label'],
                    'attr'       => ['class' => 'form-control'],
                    'data'       => $this->getDefaultValue($field, $options['import_fields']),
                ]
            );
        }
    }
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,
            ])
        ;
    }
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(','));
        }
    }
959194
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $this->addIban($builder)
            ->addBic($builder);
    }
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;
    }
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');
                },
            ]);
    }
174767
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $this->addBankGroupType($builder, $options);
    }
827065
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        /**
         * @var Plugin $plugin
         */
        $plugin = $options['plugin'];
        foreach ($plugin->getFields() as $fieldName => $field) {
            $builder
                ->remove($fieldName)
                ->add($fieldName, $field['type'], array_merge([
                    'label' => $field['label'],
                    'data' => $field['data'],
                    'required' => $field['required'],
                    'attr' => $field['attr'],
                ], $field['options']), $field);
        }

        $builder->add('save', 'submit');
    }
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);
        }
    }
289586
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($this->widget === 'ajax' && $options['multiple'] === true){
            $builder->addViewTransformer($this->transformer);
        }
    }
190976
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->addModelTransformer($this)
            ->add('name', TextType::class)
            ->add('title', TextType::class)
            ->add('headline', TextareaType::class, array(
                'required' => false,
            ))
            ->add('externalLink', TextType::class, array(
                'required' => false,
            ))
            ->add('alt', TextType::class, array(
                'required' => false,
            ))
            ->add('tags', TextType::class, array(
                'required' => false,
            ))
        ;
    }
1101718
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $required = true;
        if ($options['data']->getId()) {
            $required = false;
        }
        $builder
            ->add('active', CheckboxType::class, array('label' => 'Aktiviert', 'required' => false))
            ->add('name', TextType::class, array('label' => 'Name'))
            ->add(
                'uploadedFile',
                FileType::class,
                array(
                    'label' => 'Upload',
                    'required' => $required,
                    'constraints' => array(
                        new File(array('maxSize' => "2M")),
                        //new Image(),
                    ),
                )
            );
    }
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\']);',
                    ],
            ]);
    }
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,
                ))
            ;
        }
    }
280585
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (!$options['csrf_protection']) {
            return;
        }

        $builder
            ->addEventSubscriber(new CsrfValidationListener(
                $options['csrf_field_name'],
                $options['csrf_token_manager'],
                $options['csrf_token_id'] ?: ($builder->getName() ?: \get_class($builder->getType()->getInnerType())),
                $options['csrf_message'],
                $this->translator,
                $this->translationDomain,
                $this->serverParams
            ))
        ;
    }
359263
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $categories = $this->filterQueryHandler->handle($options['widget'], BlogCategory::class);

        //getAll categories
        $categoryQb = $this->getEntityManager()->getRepository('VictoireBlogBundle:BlogCategory')->getAll();
        //getAll published articles
        $articleQb = $this->getEntityManager()->getRepository('VictoireBlogBundle:Article')->getAll(true);

        //get Listing
        $listing = $options['widget']->getListing();

        $mode = $listing->getMode();
        switch ($mode) {
            case 'query':
                //filter with listingQuery
                $articleQb->filterWithListingQuery($listing->getQuery());
                break;
        }
        $categoryQb->filterByArticles($articleQb->getInstance('article'));
        $categories = $categoryQb->getInstance('c_category')->getQuery()->getResult();

        //the blank value
        $categoriesChoices = [];

        foreach ($categories as $category) {
            $categoriesChoices[$category->getTitle()] = $category->getId();
        }

        $data = null;
        if ($this->getRequest()->query->has('filter') && array_key_exists('category_filter', $this->getRequest()->query->get('filter'))) {
            if ($options['multiple']) {
                $data = [];
                foreach ($this->getRequest()->query->get('filter')['category_filter']['category'] as $id => $selectedCategory) {
                    $data[$id] = $selectedCategory;
                }
            } else {
                $data = $this->getRequest()->query->get('filter')['category_filter']['category'];
            }
        }

        $builder
            ->add(
                'category',
                ChoiceType::class,
                [
                    'label'       => false,
                    'choices'     => $categoriesChoices,
                    'required'    => false,
                    'expanded'    => true,
                    'multiple'    => $options['multiple'],
                    'placeholder' => $this->translator->trans('blog.category_filter.empty_value.label'),
                    'data'        => $data,
                ]
            );
    }
802039
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->buildValuesForm($builder, $options);
        $this->buildDataForm($builder, $options);

        $builder->addEventListener(
            FormEvents::POST_SUBMIT,
            function (FormEvent $event) {
                $data = $event->getData();
                if ($data instanceof DataInterface) {
                    $data->setUpdatedAt(new \DateTime());
                }
            }
        );
    }