Modify the form with the fields of the current page part

@param FormBuilderInterface $formBuilder The form builder
@param ArrayObject          $fields      The fields
@param int                  $sequence    The sequence of the form field
761139
public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields, $sequence)
    {
        $bfsf = new BooleanFormSubmissionField();
        $bfsf->setFieldName('field_' . $this->getUniqueId());
        $bfsf->setLabel($this->getLabel());
        $bfsf->setSequence($sequence);

        $data = $formBuilder->getData();
        $data['formwidget_' . $this->getUniqueId()] = $bfsf;
        $constraints = array();
        if ($this->getRequired()) {
            $options = array();
            if (!empty($this->errorMessageRequired)) {
                $options['message'] = $this->errorMessageRequired;
            }
            $constraints[] = new NotBlank($options);
        }
        $formBuilder->add('formwidget_' . $this->getUniqueId(),
            BooleanFormSubmissionType::class,
            array(
                'label' => $this->getLabel(),
                'constraints' => $constraints,
                'required' => $this->getRequired(),
            )
        );
        $formBuilder->setData($data);

        $fields->append($bfsf);
    }
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);
                }
            ));
        }
    }
1079928
protected function buildFilterForm(FormBuilderInterface $builder): void
    {
        $filtersBuilder = $builder->create(
            self::FILTERS_FORM_NAME,
            FormType::class,
            [
                'label' => false,
            ]
        );
        foreach ($this->getConfiguration()->getFilters() as $filter) {
            if ($filter->getOption('hidden', false)) {
                continue;
            }
            $filterType = $this->filterTypeRegistry->getFilterType(
                $this->getConfiguration()->getProvider(),
                $filter->getFilterType()
            );
            $formOptions = array_merge(
                [
                    'required' => false,
                    'data' => $filter->getDefault(),
                ],
                $filterType->getFormOptions($this, $filter)
            );
            if ($filter->getLabel()) {
                $formOptions['label'] = $filter->getLabel();
            }
            $filtersBuilder->add(
                $filter->getCode(),
                $filter->getFormType() ?? $filterType->getFormType(),
                $formOptions
            );
        }
        $builder->add($filtersBuilder);
    }
1024838
public function autoWireServices(ContainerBuilder $containerBuilder): void
    {
        $services = $this->getServices();
        foreach ($services as $class) {
            $containerBuilder->autowire($class, $class)->setPublic(true);
        }
    }
1297364
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (null !== $this->parent) {
            $this->parent->buildForm($builder, $options);
        }

        $this->innerType->buildForm($builder, $options);

        foreach ($this->typeExtensions as $extension) {
            $extension->buildForm($builder, $options);
        }
    }
971098
protected function storeButton(ButtonBuilder $buttonBuilder, FormBuilderInterface $form, $position)
    {

        if (!isset($this->buttons[$form->getName()])) {
            $this->buttons[$form->getName()] = array();
        }

        $this->buttons[$form->getName()][$position] = $buttonBuilder;
    }
331079
public function getChildFormBuilder(FormBuilderInterface $formBuilder, $elementId)
    {
        foreach (new FormBuilderIterator($formBuilder) as $name => $formBuilder) {
            if ($name === $elementId) {
                return $formBuilder;
            }
        }
    }
547280
protected function appendRangedFormFields(FormBuilderInterface $formBuilder)
    {
        // "From" options
        $fromDefaultOptions = [
            'label'    => 'da2e.filtration.number_filter.ranged.from.label',
            'required' => false,
        ];

        $fromUserOptions = array_key_exists('ranged_from', $this->getFormOptions())
            ? $this->getFormOptions()['ranged_from']
            : [];

        if (count($fromUserOptions) > 0) {
            $fromDefaultOptions = array_merge($fromDefaultOptions, $fromUserOptions);
        }

        $fromDefaultOptions['property_path'] = 'fromValue';

        // "To" options
        $toDefaultOptions = [
            'label'    => 'da2e.filtration.number_filter.ranged.to.label',
            'required' => false,
        ];

        $toUserOptions = array_key_exists('ranged_to', $this->getFormOptions())
            ? $this->getFormOptions()['ranged_to']
            : [];

        if (count($toUserOptions) > 0) {
            $toDefaultOptions = array_merge($toDefaultOptions, $toUserOptions);
        }

        $toDefaultOptions['property_path'] = 'toValue';

        $formBuilder->add($this->getFromValuePropertyName(), $this->getFormFieldTypeRangedFrom(), $fromDefaultOptions);
        $formBuilder->add($this->getToValuePropertyName(), $this->getFormFieldTypeRangedTo(), $toDefaultOptions);

        return $this;
    }
1136915
public function buildFieldUpdateForm(
        FormBuilderInterface $formBuilder,
        FieldDefinition $fieldDefinition,
        Content $content,
        $languageCode
    ) {
        $this->buildFieldForm($formBuilder, $fieldDefinition, $languageCode, $content);
    }
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)
            )
        ;
    }
289586
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($this->widget === 'ajax' && $options['multiple'] === true){
            $builder->addViewTransformer($this->transformer);
        }
    }
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',
                ],
            ))
        ;
    }
1271747
public function buildContentFieldValue(FormBuilderInterface $builder, FieldInterface $field)
    {
        parent::buildContentFieldValue($builder, $field);

        $builder->get('value')
            ->add('href', UrlType::class)
        ;
    }
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',
        ));
    }
385598
public function attachInputToFormBuilder(FormBuilder $formBuilder, $data = null)
    {
        //Add a new text field
        $formBuilder->add(
            $this->id,
            'checkbox',
            array(
                'label'     => $this->label,
                'data'      => filter_var($this->defaultValue, FILTER_VALIDATE_BOOLEAN),
                'required'  => false,
                'read_only' => $this->readOnly,
                'data_class'=> null
            )
        );
    }
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)
        ;
    }
229455
private function appendFields(QueryBuilder $builder, array $fields)
    {
        list($fields, $include) = $this->prepareFields($fields);
        if (!empty($fields)) {
            $method = (true === $include) ? 'select' : 'exclude';
            $builder->$method(array_keys($fields));
        }
        return $this;
    }