@param FormBuilderInterface $builder
@param array                $options

@throws \Symfony\Component\Form\Exception\InvalidArgumentException
@throws \Sidus\EAVModelBundle\Exception\MissingFamilyException
493308
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add(
            'familyCode',
            FamilySelectorType::class,
            [
                'label' => false,
                'placeholder' => 'permission.family.placeholder',
                'horizontal_input_wrapper_class' => 'col-sm-12',
            ]
        );
        foreach (FamilyPermission::getPermissions() as $permission) {
            $builder->add(
                $permission,
                CheckboxType::class,
                [
                    'widget_checkbox_label' => 'widget',
                    'horizontal_input_wrapper_class' => 'col-sm-1',
                ]
            );
        }

        $builder->get('familyCode')->addModelTransformer(
            new CallbackTransformer(
                function ($originalData) {
                    if (null === $originalData) {
                        return null;
                    }
                    // Ignoring missing family
                    if (!$this->familyRegistry->hasFamily($originalData)) {
                        return null;
                    }

                    return $this->familyRegistry->getFamily($originalData);
                },
                function ($submittedData) {
                    if ($submittedData instanceof FamilyInterface) {
                        return $submittedData->getCode();
                    }

                    return $submittedData;
                }
            )
        );
    }
327021
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $viewToIdTransformer = new ViewToIdTransformer($this->entityManager);

        $builder
            ->add($builder
                ->create('blog', HiddenType::class, ['label' => 'form.article.blog.label'])
                ->addModelTransformer($viewToIdTransformer))
            ->add('template')
            ->add('promoted', CheckboxType::class, [
                'label'    => 'form.article.type.promoted.label',
                'required' => false,
            ])
            ->add('tags', TagsType::class, [
                'required' => false,
                'multiple' => true,
            ])
            ->add('author', null, [
                'label'         => 'form.article.type.author.label',
                'required'      => true,
                'query_builder' => function (EntityRepository $er) {
                    return $er->createQueryBuilder('user')
                        ->where('user.roles LIKE :roles')
                        ->setParameter('roles', '%ROLE_VICTOIRE%');
                },
            ])
            ->remove('visibleOnFront');

        $builder->get('blog')->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
            $data = $event->getData();
            $parent = $event->getForm()->getParent();
            $this->manageCategories($data, $parent);
            $this->manageTemplate($data, $parent);
            $this->manageLocales($data, $parent);
        });

        $builder->get('blog')->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
            $data = $event->getData();
            $parent = $event->getForm()->getParent();
            $this->manageCategories($data, $parent);
            $this->manageLocales($data, $parent);
        });

        $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
            $data = $event->getData();
            $form = $event->getForm();
            $this->manageTags($data, $form);
        });
        $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
            $form = $event->getForm();
            $data = $form->getData();
            $this->manageTags($data, $form);
        });
    }
734336
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $pageHandler = $this;
        $builder
            ->add('model', 'choice', array(
                'choices'        => $this->models,
                'required'       => TRUE,
                'error_bubbling' => TRUE,
                'constraints'    => array(
                    new NotBlank(array('message' => 'fulgurio.lightcms.pages.add_form.model_is_required'))
                )
            ))
            ->add('title', 'text', array(
                'error_bubbling' => TRUE,
                'constraints'    => array(
                    new NotBlank(array('message' => 'fulgurio.lightcms.pages.add_form.title_is_required'))
                )
            ))
            ->add('parent', 'entity', array(
                'class'          => 'FulgurioLightCMSBundle:Page',
                'property'       => 'title',
                'error_bubbling' => TRUE,
                'query_builder'  => function(EntityRepository $er) {
                    return $er->createQueryBuilder('p')
                            ->orderBy('p.title', 'ASC');
                },
            ))
            ->add('fullpath', 'hidden')
            ->add('content', 'text')
            ->add('status', 'choice', array(
                'choices'         => $this->status,
                'required'        => TRUE,
                'error_bubbling'  => TRUE,
                'invalid_message' => 'fulgurio.lightcms.pages.add_form.status_is_required'
            ))
            ->add('meta_keywords', 'text', array(
                'required' => FALSE,
                'mapped'   => FALSE
            ))
            ->add('meta_description', 'text', array(
                'required' => FALSE,
                'mapped'   => FALSE
            ))
            ->add('sourceId', 'hidden')
            ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) use ($pageHandler) {
                $form = $event->getForm();
                $title = $form->get('title');
                if (in_array(LightCMSUtils::makeSlug($title->getData()), $pageHandler->getSlugExclusions()))
                {
                    $title->addError(new FormError('fulgurio.lightcms.pages.add_form.title_is_not_allowed'));
                }
            })
        ;
        if (!empty($this->langs) && count($this->langs) > 1)
        {
            $builder->add('lang', 'choice', array(
                    'choices'        => $this->langs,
                    'required'       => TRUE,
                    'error_bubbling' => TRUE
                )
            );
        }
        if (!empty($this->menus))
        {
            $builder->add('availableMenu', 'choice', array(
                'choices'        => $this->menus,
                'multiple'       => TRUE,
                'required'       => FALSE,
                'error_bubbling' => TRUE
                )
            );
        }
    }
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\']);',
                    ],
            ]);
    }
755251
public function buildValuesForm(FormBuilderInterface $builder, array $options = [])
    {
        /** @var FamilyInterface $family */
        $family = $options['family'];

        $attributes = $family->getAttributes();
        if ($options['attributes_config']) {
            if (!$options['merge_attributes_config']) {
                $attributes = [];
            }
            foreach (array_keys($options['attributes_config']) as $attributeCode) {
                $attributes[$attributeCode] = $family->getAttribute($attributeCode);
            }
        }

        foreach ($attributes as $attribute) {
            $this->attributeFormBuilder->addAttribute(
                $builder,
                $attribute,
                $this->resolveAttributeConfig($attribute, $options)
            );
        }
    }
1342419
public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add(
                self::START_NAME,
                DateType::class,
                [
                    'widget' => 'single_text',
                    'attr' => [
                        'placeholder' => 'sidus.filter.date_range.start_date',
                    ],
                ]
            )
            ->add(
                self::END_NAME,
                DateType::class,
                [
                    'widget' => 'single_text',
                    'attr' => [
                        'placeholder' => 'sidus.filter.date_range.end_date',
                    ],
                ]
            );
    }
870683
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add($builder
                ->create('tree', HiddenType::class, array(
                    'attr' => array(
                        'class' => 'synapse-tree-menu',
                        'data-labels' => json_encode(array(
                            'link' => array(
                                'name' => 'Name',
                                'url' => 'Url',
                            ),
                        )),
                    ),
                ))
                ->addModelTransformer($this)
            )
        ;
    }
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)
        ;
    }
855823
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $fields = AppSettings::settings();
        foreach ($fields as $key => $value) {
            $builder->add($key, TextType::class, [
                'value' => $value,
                'required' => true,
                'constraints' => [ new Symfony\Component\Validator\Constraints\NotBlank()]
            ]);
        }
    }
124912
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->addWalletType($builder, $options[SubFormInterface::OPTIONS_FIELD_NAME][static::OPTION_WALLET_CHOICES]);
    }
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,
                ]
            );
    }
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'],
                ]
            );
    }
42490
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (null !== $options['class']){
            $this->transformer->setClass($options['class']);
            $builder->addModelTransformer($this->transformer);
        }   
    }
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;
                }
            )
        );
    }
1241367
public function buildForm (FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name', 'text', array(
                'label' => 'Nom du groupe'
            ))
            ->add('roles', 'choice', array(
                'label' => 'Rôles',
                'choices' => $this->getRoles(),
                'multiple' => true,
                'expanded' => true
            ))
            ->add('users', 'olix_doublelist_entity', array(
                'label' => 'Utilisateurs',
                'class' => 'OlixSecurityBundle:User',
                'property' => 'name',
                'mapped' => 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,
            ))
        ;
    }
196584
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->addModelTransformer(new CallbackTransformer(
            function ($original) {
                $tree = $this->blockService->getTree($original);

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

                $stripped = $this->stripMetadata($array);

                return trim(json_encode($stripped));
            }
        ));
    }