Options form prototype definition.

@see FormInterface::buildForm()
550003
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('x', NumberType::class, array())
            ->add('y', NumberType::class, array())
            ->add('width', NumberType::class, array())
            ->add('height', NumberType::class, array())
            ->add('rotate', NumberType::class, array())
            ->add('scaleX', NumberType::class, array())
            ->add('scaleY', NumberType::class, array())
        ;
    }
174767
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $this->addBankGroupType($builder, $options);
    }
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',
            ]);
    }
246242
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('idPage', 'hidden', array('label' => 'pages_controller_label_permalink'));
        $builder->add('idLanguage', 'choice', array('choices' => ChoiceValues::getLanguages($this->languageRepository)));
        $builder->add('permalink', 'textarea', array(
            'label' => 'pages_controller_label_permalink',
            'attr' => array(
                'rows' => '3',
            ),));
        $builder->add('title', 'textarea', array(
            'label' => 'pages_controller_label_meta_title',
            'attr' => array(
                'title' => 'pages_controller_meta_title_explanation',
                'rows' => '3',
            ),
        ));
        $builder->add('description', 'textarea', array(
            'label' => 'pages_controller_label_meta_description',
            'attr' => array(
                'title' => 'pages_controller_meta_description_explanation',
                'rows' => '3',
            ),
        ));
        $builder->add('keywords', 'textarea', array(
            'label' => 'pages_controller_label_meta_keywords',
            'attr' => array(
                'title' => 'pages_controller_meta_keywords_explanation',
                'rows' => '2',
            ),
        ));
        $builder->add('sitemapChangeFreq', 'choice', array(
            'choices' => array(
                '' => '-',
                'always' => 'always',
                'hourly' => 'hourly',
                'daily' => 'daily',
                'weekly' => 'weekly',
                'monthly' => 'monthly',
                'yearly' => 'yearly',
                'never' => 'never',
            ),
            'label' => 'pages_controller_label_change frequency',
        ));
        $builder->add('sitemapPriority', 'choice', array(
            'choices' => array(
                '0.0' => '0.0',
                '0.1' => '0.1',
                '0.2' => '0.2',
                '0.3' => '0.3',
                '0.4' => '0.4',
                '0.5' => '0.5',
                '0.6' => '0.6',
                '0.7' => '0.7',
                '0.8' => '0.8',
                '0.9' => '0.9',
                '1.0' => '1.0',
            ),
            'data' => '0.5',
            'label' => 'pages_controller_label_priority',
        ));
    }
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,
            ))
        ;
    }
228417
public function buildForm(array $form, FormStateInterface $form_state) {
    $form['#title'] = $this->t('Configure Presto functionality');

    // Clear any module success messages.
    drupal_get_messages('status');

    // Add configuration forms for optional deps if defined.
    $optionalDeps = $this->optionalDependencyManager->getDefinitions();
    $form['optional_dependencies'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('Optional Dependencies'),
      '#collapsible' => FALSE,
      '#tree' => TRUE,
    ];

    $hasOptionalDepsForm = FALSE;
    $form_state->set('optional_dependencies', []);
    foreach ($optionalDeps as $optionalDep) {
      /** @var \Drupal\presto\Installer\OptionalDependencies\OptionalDependencyInterface $instance */
      $instance = $this->optionalDependencyManager->createInstance(
        $optionalDep['id']
      );

      $pluginForm = [];
      $subFormState = SubformState::createForSubform(
        $pluginForm,
        $form,
        $form_state
      );
      $form['optional_dependencies'][$optionalDep['id']] = $instance->buildConfigurationForm(
        $pluginForm,
        $subFormState
      );

      if (count($form['optional_dependencies'][$optionalDep['id']]) > 0) {
        $hasOptionalDepsForm = TRUE;
      }

      $form_state->set(['optional_dependencies', $optionalDep['id']], $instance);
    }

    // Hide optional dependencies fieldset if the config form is empty.
    $form['optional_dependencies']['#access'] = $hasOptionalDepsForm;

    $form['ecommerce'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('eCommerce'),
      '#collapsible' => FALSE,
    ];

    // Only enable commerce if this profile was installed via Composer
    // (which is when the below interface will exist).
    $enableCommerce = FALSE;
    /** @noinspection ClassConstantCanBeUsedInspection */
    if (interface_exists('CommerceGuys\Intl\Currency\CurrencyInterface')) {
      $enableCommerce = TRUE;
    }

    if (!$enableCommerce) {
      $disabledMsg = $this->t('<p><strong>Not supported.</strong></p><p>Unfortunately, eCommerce is only supported if you install Presto via Composer. <a href=":url">See the README for more information on installing via Composer.</a></p>', [
        ':url' => 'https://github.com/Sitback/presto#installing-presto',
      ]);
      $form['ecommerce']['disabled_info'] = [
        '#type' => 'markup',
        '#markup' => $disabledMsg,
      ];
    }

    $form['ecommerce']['enable_ecommerce'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Enable eCommerce'),
      '#description' => $this->t(
        'Enables Drupal Commerce and some sane defaults to help you kickstart your eCommerce site.'
      ),
      '#disabled' => !$enableCommerce,
      '#default_value' => $enableCommerce,
    ];

    $form['ecommerce']['ecommerce_install_demo_content'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Install Demo Content'),
      '#description' => $this->t(
        'Creates a few demo products to help you test your new eCommerce site.'
      ),
      '#disabled' => !$enableCommerce,
      '#default_value' => $enableCommerce,
      '#states' => [
        'visible' => [
          'input[name="enable_ecommerce"]' => [
            'checked' => TRUE,
          ],
        ],
        'unchecked' => [
          'input[name="enable_ecommerce"]' => [
            'checked' => FALSE,
          ],
        ],
      ],
    ];

    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Save and continue'),
      '#button_type' => 'primary',
      '#submit' => ['::submitForm'],
    ];

    return $form;
  }
501621
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('id', 'hidden')
            ->add('typeOfSchoolAttendanceAtFourteen', 'choice',
                array(
                    'placeholder' => 'form.select',
                    'label'       => 'socioEconomic.form.typeOfSchoolAttendanceAtFourteen.label',
                    'choices'     => array(
                        'A state run or funded school that did not select pupils on the basis of academic ability (e.g. a comprehensive, secondary modern, Scottish High School/Secondary School/Academy)' => 'A state run or funded school that did not select pupils on the basis of academic ability (e.g. a comprehensive, secondary modern, Scottish High School/Secondary School/Academy)',
                        'A state run or funded school that selected on the basis of academic ability'                                                                                                      => 'A state run or funded school that selected on the basis of academic ability',
                        'An independent school, but your fees were paid in part or full by the local authority (sometimes called a ‘direct grant’ school or an ‘assisted place’)'                          => 'An independent school, but your fees were paid in part or full by the local authority (sometimes called a ‘direct grant’ school or an ‘assisted place’)',
                        'An independent school, but your fees were paid in part or full by a bursary or scholarship'                                                                                       => 'An independent school, but your fees were paid in part or full by a bursary or scholarship',
                        'An independent school, and your fees were not paid in part by the local authority or bursary/scholarship'                                                                         => 'An independent school, and your fees were not paid in part by the local authority or bursary/scholarship',
                        'A school outside the UK education system'                                                                                                                                         => 'A school outside the UK education system',
                        'Prefer not to say'                                                                                                                                                                => 'Prefer not to say',
                    )
                )
            )
            ->add('firstPersonInImmediateFamilyToAttendUniversity', 'choice',
                array(
                    'placeholder' => 'form.select',
                    'label'       => 'socioEconomic.form.firstPersonInImmediateFamilyToAttendUniversity.label',
                    'choices'     => array(
                        'Yes'               => 'Yes',
                        'No'                => 'No',
                        'Don\'t Know'       => 'Don\'t Know',
                        'Prefer Not to Say' => 'Prefer Not to Say',
                    )
                )
            )
            ->add('eligibleForFreeSchoolMeals', 'choice',
                array(
                    'placeholder' => 'form.select',
                    'label'       => 'socioEconomic.form.eligibleForFreeSchoolMeals.label',
                    'choices'     => array(
                        'Yes'               => 'Yes',
                        'No'                => 'No',
                        'Don\'t Know'       => 'Don\'t Know',
                        'Prefer Not to Say' => 'Prefer Not to Say',
                    )
                )
            )
            ->add('everSpentMoreThanThreeMonthsInCare', 'choice',
                array(
                    'placeholder' => 'form.select',
                    'label'       => 'socioEconomic.form.everSpentMoreThanThreeMonthsInCare.label',
                    'choices'     => array(
                        'Yes'               => 'Yes',
                        'No'                => 'No',
                        'Don\'t Know'       => 'Don\'t Know',
                        'Prefer Not to Say' => 'Prefer Not to Say',
                    )
                )
            )
            ->add('everPersonallyHadRefugeeOrAsylumStatus', 'choice',
                array(
                    'placeholder' => 'form.select',
                    'label'       => 'socioEconomic.form.everPersonallyHadRefugeeOrAsylumStatus.label',
                    'choices'     => array(
                        'Yes'               => 'Yes',
                        'No'                => 'No',
                        'Don\'t Know'       => 'Don\'t Know',
                        'Prefer Not to Say' => 'Prefer Not to Say',
                    )
                )
            );

        return $builder;
    }
1196975
public function buildForm(FormBuilderInterface $builder, array $options) {
        /** @var ClassAwareDataTransformerInterface $entityTransformer */
        $entityTransformer = new $options['transformer']($this->om, $options['class']);
        $builder->addModelTransformer($entityTransformer);
    }
1255992
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        /** @var FamilyInterface $family */
        $family = $options['family'];

        /** @noinspection DateTimeConstantsUsageInspection */
        $builder
            ->add(
                'format',
                ChoiceType::class,
                [
                    'choices' => [
                        'CSV' => 'csv',
                        'JSON' => 'json',
                    ],
                ]
            )
            ->add(
                'csvDelimiter',
                ChoiceType::class,
                [
                    'choices' => [
                        'Semicolon ;' => ';',
                        'Comma ,' => ',',
                        'Tab \\t' => "\t",
                        'Pipe |' => '|',
                    ],
                ]
            )
            ->add(
                'csvEnclosure',
                ChoiceType::class,
                [
                    'choices' => [
                        '"' => '"',
                        "'" => "'",
                    ],
                ]
            )
            ->add(
                'csvEscape',
                ChoiceType::class,
                [
                    'choices' => [
                        'Backslash \\' => '\\',
                    ],
                ]
            )
            ->add(
                'onlySelectedEntities',
                CheckboxType::class,
                [
                    'required' => false,
                    'help_block' => 'If selected, only the entities with the following Ids will be exported',
                    'widget_checkbox_label' => 'label',
                ]
            )
            ->add(
                'selectedIds',
                TextType::class,
                [
                    'attr' => [
                        'readonly' => 'readonly',
                    ],
                    'required' => false,
                    'help_block' => 'These values comes from the last resultset found in session',
                ]
            )
            ->add(
                'dateFormat',
                ChoiceType::class,
                [
                    'choices' => [
                        'ISO 8601' => \DateTime::ISO8601,
                        'W3C/ATOM (RFC3339)' => \DateTime::W3C,
                        'Simple date: Y-m-d' => 'Y-m-d',
                        'Simple datetime: Y-m-d H:i' => 'Y-m-d H:i',
                    ],
                ]
            )
            ->add(
                'splitCharacter',
                ChoiceType::class,
                [
                    'choices' => [
                        'Comma ,' => ',',
                        'Pipe |' => '|',
                        'Semicolon ;' => ';',
                        'Slash /' => '/',
                    ],
                    'help_block' => 'For collection attributes',
                ]
            )
            ->add(
                'booleanFormat',
                ChoiceType::class,
                [
                    'choices' => [
                        '1/0' => 'binary',
                        'true/false' => 'boolean',
                        'yes/no' => 'english',
                    ],
                    'help_block' => 'For boolean attributes',
                ]
            )
            ->add(
                'attributes',
                FormType::class,
                [
                    'required' => false,
                    'help_label' => '<div class="btn-group"><button type="button" data-select-all="form_project_export[attributes]" class="btn btn-default">Select all</button><button type="button" data-select-none="form_project_export[attributes]" class="btn btn-default">Select none</button></div>',
                ]
            );

        /** @var FormBuilderInterface $attributesBuilder */
        $attributesBuilder = $builder->get('attributes');
        foreach ($family->getAttributes() as $attribute) {
            $attributesBuilder->add(
                $attribute->getCode(),
                AttributeExportConfigType::class,
                [
                    'required' => false,
                    'attribute' => $attribute,
                ]
            );
        }
    }
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));
            }
        ));
    }
905749
protected function buildForm($form = null, $object = null, array $options = [])
    {
        return $this->getFormFactory()->create($form ?: $this->resource, $object, $options);
    }
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,
            ])
        ;
    }
297666
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($options['plugin'] !== $this->plugin) {
            return;
        }

        $this->buildPluginForm($builder, $options);
    }
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',
            ]);
        }
    }
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,
            ))
        ;
    }
1258913
public function form(array $options = [])
    {
        $method = empty($options['method']) ? $options['method'] : '';
        if (!in_array(strtolower($method), ['get', 'post'])) {
            $options['method'] = 'POST';
        }
        // Throw in all the attributes meant for the form
        return '<form '.$this->attributes($options['form']).'>'.
        $this->method($options['method']).
        $this->buildForm().
        $this->submit().'</form>';
    }
1015658
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $builder->add('layout', ChoiceType::class, [
            'label'   => 'form.template.type.layout.label',
            'choices' => array_flip($options['layouts']),
        ]);

        $builder->add('translations', TranslationsType::class, [
            'fields' => [
                'name' => [
                    'label' => 'form.view.type.name.label',
                ],
            ],
        ]);

        $builder->remove('roles');
    }