Builds the form for the given extension model and its settings.

@param ExtensionModel $model
@param SettingsFormContract $settingsForm
@param SettingsContract $settings
@return \Antares\Contracts\Html\Builder
554009
public function build(ExtensionModel $model, SettingsFormContract $settingsForm, SettingsContract $settings)
    {
        return $this->formFactory->make(function(FormGrid $form) use($model, $settingsForm, $settings) {
                    $url = route(area() . '.modules.viewer.configuration.update', ['id' => $model->getId()]);

                    $form->simple($url, [], $model);
                    $form->name($model->getFullName() . ' Configuration');
                    $form->hidden('id');
                    $form->layout('antares/foundation::components.form');

                    $form->fieldset('Configuration', function(Fieldset $fieldset) use($settingsForm, $settings) {
                        $settingsForm->build($fieldset, $settings);

                        $fieldset->control('button', 'button')
                                ->attributes(['type' => 'submit', 'class' => 'btn btn-primary'])
                                ->value(trans('antares/foundation::label.save_changes'));
                    });

                    $form
                            ->rules($settings->getValidationRules())
                            ->phrases($settings->getValidationPhrases());
                });
    }
1139380
protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
    {
        $page1 = $formDefinition->createPage('page1');
        $page1->setRenderingOption('header', 'Select your Git Driver');

        $driverSection = $page1->createElement('driverSection', 'TYPO3.Form:Section');

        $gitDriver = $driverSection->createElement('gitDriver', 'TYPO3.Form:SingleSelectDropdown');
        $gitDriver->setLabel('Git Driver');
        $gitDriver->setProperty('options', ['GitHub' => 'Git Hub', 'GitLab' => 'Git Lab', 'BitBucket' => 'Bit Bucket']);
        $gitDriver->addValidator(new NotEmptyValidator());
        $gitDriver->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
            'Lightwerk.SurfCaptain.sources.default.driver'));

        $formDefinition->setRenderingOption('skipStepNotice',
            'If you skip this step make sure that you have configured your Git Repositories in Settings.yaml');
    }
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',
            ]);
        }
    }
879244
public function addFromModel(FormBuilderInterface $builder, array $model, $editMode) 
	{
        foreach( $model as $property => $parameters ) {
            if( isset($parameters['type']) && $parameters['type'] == 'group') {
                $options = array();
                if (isset($parameters['options'])) {
                    $options = $parameters['options'];
                }

                $builder->add($this->getBuilder($property, $options, $parameters['fields'], $editMode));
            } else {
                if (!isset($parameters['widget'])) {
                    throw new \RuntimeException("You must specify a widget for $property");
                }

                $widget = $parameters['widget'];
                $this->buildField($builder, $property, $widget, $editMode);
            }
        }
    }
42490
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (null !== $options['class']){
            $this->transformer->setClass($options['class']);
            $builder->addModelTransformer($this->transformer);
        }   
    }
1305190
public function setup(Model $model, $settings = array()) {
        $settings = array_merge($this->_defaults, $settings);
        $this->settings[$model->alias] = $settings;

        // Store the default model validate set
        if ($model->validate) {
            if (empty($model->validations)) {
                $model->validations = array();
            }

            $model->validations[$settings['defaultSet']] = $model->validate;
            $model->validate = array();
        }
    }
141763
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $templateType = $options['template_type'];
        $variation = $options['variation'];

        $builder
            ->addModelTransformer($this)

            // build template zones
            ->add('zones', CollectionType::class, array(
                'allow_add' => false,
                'allow_delete' => false,
                'entry_type' => ZoneType::class,
                'entry_options' => array(
                    'theme' => $options['theme'],
                    'content_type' => $options['content_type'],
                    'template_type' => $options['template_type'],
                ),
            ))

            // zone type selection (unmapped, frontend use case - should be defined in Twig layout ?)
            ->add('zone_types', ChoiceType::class, array(
                'mapped' => false,
                'required' => true,
                'expanded' => false,
                'choices' => $templateType->getZoneTypes()->indexBy('name'),
                'choice_value' => 'name',
                'choice_label' => 'name',

                // main zone by default
                'data' => $templateType->getZoneTypes()
                    ->filter(function (ZoneTypeInterface $zoneType) use ($variation) {
                        return $variation->getConfiguration(
                            'zones', $zoneType->getName(), 'main', false
                        );
                    })
                    ->first() ?: null,
            ))
        ;
    }
255526
protected function createComponentConfigurationForm(): Form
	{
		$form = $this->formFactory->create();
		$form->setAjaxRequest();

		$form->addGroup('cms.settings.basic');
		$form->addImageUpload('cmsLogo', 'cms.settings.logo', 'cms.settings.deleteLogo')
			->setNamespace('cms')
			->setPreview('300x100');
		$form->addCheckbox('sendNewUserPassword', 'cms.settings.sendNewUserPassword');
		$form->addCheckbox('sendChangePassword', 'cms.settings.sendChangePassword');
		$form->addCheckbox('dockbarAdvanced', 'cms.settings.dockbarAdvanced');
		$form->addSelectUntranslated('defaultLocale', 'cms.settings.defaultLocale', $this->localeService->fetch())
			->setDefaultValue($this->localeService->defaultLocaleId);
		$form->addMultiSelectUntranslated('allowedLocales', 'cms.settings.allowedLocales', $this->localeService->fetch())
			->setDefaultValue($this->localeService->allowedLocaleIds)
			->setRequired();

		$form->addGroup('cms.settings.development');
		if (!$this->tracy->isEnabled()) {
			$form->addLink('debugOn', 'cms.settings.debugOn')
				->link($this->link('debug!', true))
				->setAjaxRequest()
				->addClass('btn-success')
				->setAttribute('data-ajax-off', 'history');
		} else {
			$form->addLink('debugOff', 'cms.settings.debugOff')
				->link($this->link('debug!', false))
				->setAjaxRequest()
				->addClass('btn-danger')
				->setAttribute('data-ajax-off', 'history');
		}
		$form->addCheckbox('mailPanel', 'cms.settings.mailPanel')
			->setDefaultValue($this->configurator->mailPanel);

		$form->getRenderer()->primaryButton = $form->addSubmit('save', 'form.save');

		$form->onSuccess[] = [$this, 'configurationFormSucseeded'];

		return $form;
	}
1129775
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->entityProxyFieldsBuilder->buildForEntityAndWidgetType($builder, $options['widget'], $options['namespace']);
    }
1275430
protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
    {
        $page1 = $formDefinition->createPage('page1');
        $page1->setRenderingOption('header', 'Deployment Settings');

        $deploymentSection = $page1->createElement('deploymentSection', 'TYPO3.Form:Section');

        $user = $deploymentSection->createElement('defaultUser', 'TYPO3.Form:SingleLineText');
        $user->setLabel('Deployment user. Default SSH user for deployment on target systems (optional, will be configurable per target system later on).');
        $user->setDefaultValue(
            Arrays::getValueByPath(
                $this->distributionSettings,
                'Lightwerk.SurfCaptain.frontendSettings.defaultUser'
            )
        );

        $path = $deploymentSection->createElement('defaultDeploymentPath', 'TYPO3.Form:SingleLineText');
        $path->setLabel('Deployment Path. Default target path for deployments, e.g. "/var/www/{{project}}/{{suffix}}/htdocs/" (optional, will be configurable per target system later on	).');
        $path->setDefaultValue(
            Arrays::getValueByPath(
                $this->distributionSettings,
                'Lightwerk.SurfCaptain.frontendSettings.defaultDeploymentPath'
            )
        );

        $formDefinition->setRenderingOption(
            'skipStepNotice',
            'You can always configure your frontend settings later in Settings.yaml'
        );
    }
776069
public function getExtensionModel()
    {
        if ($this->extensionModel === null) {
            $this->load->model('setting/extension');
            /** @noinspection PhpUndefinedFieldInspection */
            $this->extensionModel = $this->model_setting_extension;
        }
        return $this->extensionModel;
    }
493382
public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        // Get the context and membership provider to pass into transformer.
        $context = $this->production_context;
        $provider = $this->membership_provider;

        $builder
            ->add('optional', null, [
                'label' => 'invitation.form.optional',
            ])
            ->add('invitee', ChoiceType::class, [
                'label' => 'invitation.form.invitee',
                'placeholder' => 'invitation.form.choose_invitee',
                'choice_translation_domain' => false,

                // Load all active memberships for a production as choices.
                'choice_loader' => new CallbackChoiceLoader(function () use ($context, $provider) {
                    foreach ($provider->loadActiveMembershipsByProduction($context->getContext()) as $membership) {
                        $member = $membership->getMember();
                        yield $member->__toString() => $member->getUsername();
                    }
                }),
            ])
        ;
    }
360912
public function setup(Model $model, $settings = array()) {
        if ($settings) {
            foreach ($settings as $field => $options) {
                $this->settings[$model->alias][$field] = (array) $options + array('required' => true);
            }
        }
    }
400125
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->getFormFieldsExtended($builder, $options, 'extendedField');
        $this->getFormFieldsExtended($builder, $options, 'extendedFieldSecure');
    }
1154807
public function renderField(Model $model, $attribute, array $settings = [])
    {
        $fieldOptions = ArrayHelper::getValue($settings, 'fieldOptions', []);
        $field = $this->field($model, $attribute, $fieldOptions);

        if (($label = ArrayHelper::getValue($settings, 'label')) !== null) {
            $field->label($label, ArrayHelper::getValue($settings, 'labelOptions', []));
        }
        if (($hint = ArrayHelper::getValue($settings, 'hint')) !== null) {
            $field->hint($hint, ArrayHelper::getValue($settings, 'hintOptions', []));
        }

        $type = ArrayHelper::getValue($settings, 'type', static::INPUT_TEXT);
        $this->prepareField($field, $type, $settings);

        return $field;
    }
516246
public function getConfiguration($form, $model, $context)
    {
        $fields = null;
        foreach ($this->adjusterRegistry->getFormViewProviders() as $provider) {
            if ($provider->supports($form, $model, $context)) {
                $fields = $provider->getFields($model, $context);
                break;
            }
        }
        if ($fields === null) {
            $fields = $this->getFields($model, $form);
        }
        $fields = $this->normalizeFields($fields);
        return $this->getFieldsConfiguration($model, $fields);
    }
1307077
public function applyFormats(ContainerBuilder $container, array $settings)
    {
        foreach ($settings['contexts'] as $name => $context) {
            // add the different related formats
            foreach ($context['providers'] as $id) {
                $definition = $container->getDefinition($id);

                foreach ($context['formats'] as $format => $config) {
                    $config['quality'] = $config['quality'] ?? 80;
                    $config['format'] = $config['format'] ?? 'jpg';
                    $config['height'] = $config['height'] ?? null;
                    $config['constraint'] = $config['constraint'] ?? true;
                    $config['resizer'] = $config['resizer'] ?? false;

                    $formatName = sprintf('%s_%s', $name, $format);
                    $definition->addMethodCall('addFormat', [$formatName, $config]);
                }
            }
        }
    }