This method should be overloaded to build out the detail form.

@return Form
480093
public function Form()
    {
        $form = new Form(
            $this,
            'SilverStripe\\Forms\\Form',
            new FieldList($root = new TabSet('Root', new Tab('Main'))),
            new FieldList()
        );

        if ($this->getTopLevelController() instanceof LeftAndMain) {
            $form->setTemplate('LeftAndMain_EditForm');
            $form->addExtraClass('cms-content cms-edit-form cms-tabset center');
            $form->setAttribute('data-pjax-fragment', 'CurrentForm Content');

            $root->setTemplate('CMSTabSet');
            $form->Backlink = $this->getBackLink();
        }

        return $form;
    }
1227177
public function getHTMLDetails()
    {
        // Add disabled to be able to disable a form element
        // Add maxlength
        $id =  $this->getElementId();

        $class = isset($this['class'])
            ? "{$this['class']}"
            : null;

        $validates = (isset($this['validation-pass']) && $this['validation-pass'] === false)
            ? ' validation-failed'
            : null;

        $class = (isset($class) || isset($validates))
            ? " class='{$class}{$validates}'"
            : null;

        $wrapperElement = isset($this['wrapper-element'])
            ? $this['wrapper-element']
            : $this->default["wrapper-element"];

        $wrapperClass = isset($this['wrapper-class'])
            ? " class=\"{$this['wrapper-class']}\""
            : null;

        $brAfterLabel = isset($this['br-after-label'])
            ? $this['br-after-label']
            : $this->default["br-after-label"];

        $brAfterLabel = $brAfterLabel
            ? "<br>"
            : null;

        $name = " name='{$this['name']}'";

        $label = isset($this['label'])
            ? ($this['label'] . (isset($this['required']) && $this['required']
                ? "<span class='form-element-required'>*</span>"
                : null))
            : null;

        $autofocus = isset($this['autofocus']) && $this['autofocus']
            ? " autofocus='autofocus'"
            : null;

        $required = isset($this['required']) && $this['required']
            ? " required='required'"
            : null;

        $readonly = isset($this['readonly']) && $this['readonly']
            ? " readonly='readonly'"
            : null;

        $placeholder = isset($this['placeholder']) && $this['placeholder']
            ? " placeholder='{$this['placeholder']}'"
            : null;

        $multiple = isset($this['multiple']) && $this['multiple']
            ? " multiple"
            : null;

        $max = isset($this['max'])
            ? " max='{$this['max']}'"
            : null;

        $min = isset($this['min'])
            ? " min='{$this['min']}'"
            : null;

        $low = isset($this['low'])
            ? " low='{$this['low']}'"
            : null;

        $high = isset($this['high'])
            ? " high='{$this['high']}'"
            : null;

        $optimum = isset($this['optimum'])
            ? " optimum='{$this['optimum']}'"
            : null;

        $step = isset($this['step'])
            ? " step='{$this['step']}'"
            : null;

        $size = isset($this['size'])
            ? " size='{$this['size']}'"
            : null;

        $text = isset($this['text'])
            ? htmlentities($this['text'], ENT_QUOTES, $this->characterEncoding)
            : null;

        $checked = isset($this['checked']) && $this['checked']
            ? " checked='checked'"
            : null;

        $type = isset($this['type'])
            ? " type='{$this['type']}'"
            : null;

        $title = isset($this['title'])
            ? " title='{$this['title']}'"
            : null;

        $pattern = isset($this['pattern'])
            ? " pattern='{$this['pattern']}'"
            : null;

        $description = isset($this['description'])
            ? $this['description']
            : null;

        $novalidate = isset($this['formnovalidate'])
            ? " formnovalidate='formnovalidate'"
            : null;

        $onlyValue = isset($this['value'])
            ? htmlentities($this['value'], ENT_QUOTES, $this->characterEncoding)
            : null;

        $value = isset($this['value'])
            ? " value='{$onlyValue}'"
            : null;

        $onclick = isset($this['onclick'])
            ? " onclick=\"{$this['onclick']}\""
            : null;

        $maxlength = isset($this['maxlength'])
            ? " maxlength='{$this['maxlength']}'"
            : null;

        $messages = $this->getValidationMessages();

        return [
            'id'             => $id,
            'class'          => $class,
            'wrapperElement' => $wrapperElement,
            'wrapperClass'   => $wrapperClass,
            'brAfterLabel'   => $brAfterLabel,
            'name'           => $name,
            'label'          => $label,
            'autofocus'      => $autofocus,
            'required'       => $required,
            'readonly'       => $readonly,
            'placeholder'    => $placeholder,
            'multiple'       => $multiple,
            'min'            => $min,
            'max'            => $max,
            'maxlength'      => $maxlength,
            'low'            => $low,
            'high'           => $high,
            'step'           => $step,
            'optimum'        => $optimum,
            'size'           => $size,
            'text'           => $text,
            'checked'        => $checked,
            'type'           => $type,
            'title'          => $title,
            'pattern'        => $pattern,
            'description'    => $description,
            'novalidate'     => $novalidate,
            'onlyValue'      => $onlyValue,
            'value'          => $value,
            'onclick'        => $onclick,
            'messages'       => $messages,
        ];
    }
841537
private function getForm()
    {
        $rule = $this->ruleFactory->create();

        if ($this->getOptimizer() && $this->getOptimizer()->getRuleCondition()) {
            $rule = $this->getOptimizer()->getRuleCondition();
        }

        $form = $this->formFactory->create();
        $form->setHtmlId('rule_condition');

        $ruleConditionField = $form->addField(
            'rule_condition',
            'text',
            ['name' => 'rule_condition', 'label' => __('Rule conditions'), 'container_id' => 'rule_condition']
        );

        $ruleConditionField->setValue($rule);
        $ruleConditionRenderer = $this->getLayout()->createBlock('Smile\ElasticsuiteCatalogRule\Block\Product\Conditions');
        $ruleConditionField->setRenderer($ruleConditionRenderer);

        return $form;
    }
717523
public function Form()
    {
        $svc            = singleton(WorkflowService::class);
        $active         = $svc->getWorkflowFor($this->getContextObject());

        if (!$active) {
            return;
            //throw new Exception('Workflow not found, or not specified for Context Object');
        }

        $wfFields     = $active->getFrontEndWorkflowFields();
        $wfActions    = $active->getFrontEndWorkflowActions();
        $wfValidator  = $active->getFrontEndRequiredFields();

        //Get DataObject for Form (falls back to ContextObject if not defined in WorkflowAction)
        $wfDataObject = $active->getFrontEndDataObject();

        // set any requirements spcific to this contextobject
        $active->setFrontendFormRequirements();

        // hooks for decorators
        $this->extend('updateFrontEndWorkflowFields', $wfFields);
        $this->extend('updateFrontEndWorkflowActions', $wfActions);
        $this->extend('updateFrontEndRequiredFields', $wfValidator);
        $this->extend('updateFrontendFormRequirements');

        $form = new FrontendWorkflowForm($this, 'Form/' . $this->getContextID(), $wfFields, $wfActions, $wfValidator);

        $form->addExtraClass("fwf");

        if ($wfDataObject) {
            $form->loadDataFrom($wfDataObject);
        }

        return $form;
    }
255707
public function getForm()
    {

        $view = new View();

        return $view->render(__DIR__ . '/../views/ulogin', [
            'widget' => $this->widget,
            'fields' => $this->requiredFields,
            'optional' => $this->optionalFields,
            'providers' => $this->requiredProviders,
            'hidden' => $this->hiddenProviders,
            'url' => $this->url
        ]);

    }
795372
public function AddForm() {
		$classes = ClassInfo::subclassesFor(self::$tree_class);
		array_shift($classes);

		foreach ($classes as $key => $class) {
			if (!singleton($class)->canCreate())
				unset($classes[$key]);
			$classes[$key] = FormField::name_to_label($class);
		}

		$fields = new FieldList(
			new HiddenField("ParentID"),
			new HiddenField("Locale", 'Locale', i18n::get_locale()),
			$type = new DropdownField("ProviderType", "", $classes)
		);
		$type->setAttribute('style', 'width:150px');

		$actions = new FieldList(
			FormAction::create("addprovider", _t('ExternalContent.CREATE', "Create"))
				->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')
				->setUseButtonTag(true)
		);

		$form = new Form($this, "AddForm", $fields, $actions);

		$form->addExtraClass('cms-edit-form ' . $this->BaseCSSClasses());
		$this->extend('updateEditForm', $form);

		return $form;
	}
575092
public function SummaryForm()
    {
        $summary = new SummaryForm($this, 'SummaryForm', ReservationSession::get());
        $summary->setNextStep(CheckoutSteps::nextStep($this->step));
        return $summary;
    }
280151
public function buildForm()
    {

        $this
            ->add($this->model->getKeyName(), 'hidden')
            ->add('email', 'email',
                [
                    'label'      => trans('expendable::form.email'),
                    'validation' => 'required,custom[email]',
                ]);

        $id = $this->model->getKey();

        if (!empty($id))
        {
            $this->add('change_password', 'checkbox', [
                'default_value' => 1,
                'label'         => trans('expendable::form.change_password_help'),
                'checked'       => false,
                'noInEditView'  => true
            ]);
        }

        $this->add('password', 'password',
            [
                'label'        => trans('expendable::form.password'),
                'attr'         => ['id' => 'password'],
                'validation'   => 'required',
                'noInEditView' => true
            ])
            ->add('password_match', 'password',
                [
                    'label'        => trans('expendable::form.repeat_password'),
                    'validation'   => 'required,equals[password]',
                    'noInEditView' => true
                ])
            ->add('status', 'choice', [
                'choices'     => StaticLabel::status(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.status')
            ])
            ->add('role_id', 'choice', [
                'choices'     => Role::getChoice(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.role')
            ])
            ->addDefaultActions();
    }
487888
public function generateForm(): string
    {
        foreach ($this->fields as $field) {
            if (is_array($field)) {
                $this->renderGroup($field);
                continue;
            }

            $this->form .= $this->render($field);
        }

        return $this->form;
    }
232831
public function Form()
    {
        $form = UserForm::create($this, 'Form_' . $this->ID);
        /** @skipUpgrade */
        $form->setFormAction(Controller::join_links($this->Link(), 'Form'));
        $this->generateConditionalJavascript();
        return $form;
    }
927729
public function getFromForm()
    {
        if ($this->form !== null) {
            $this->notification_email = $this->form->notification_email;
            if ($this->form->full_name !== '') {
                $this->full_name = $this->form->full_name;
            }
            $this->display_name = $this->form->display_name;
            $this->tz = $this->form->tz;
            $this->location = TextHelper::clearText($this->form->location);
            $this->about = TextHelper::clearText($this->form->about);
            $this->custom_fields = $this->form->custom_fields;
        }
    }
480244
public function getFromForm()
    {
        if ($this->form !== null) {
            $this->user_id = $this->form->user_id;
            $this->phone = $this->form->phone;
            $this->code = $this->form->code;
            $this->type_id = $this->form->type_id;
            $this->ip = $this->form->ip;
            $this->is_used = $this->form->is_used;
            $this->is_validated = $this->form->is_validated;
            $this->is_deleted = $this->form->is_deleted;
        }
    }
618553
protected function definition() {
        $form = $this->_form;
        $stores = $this->_customdata;

        $options = array(
            cache_store::MODE_APPLICATION => array(),
            cache_store::MODE_SESSION => array(),
            cache_store::MODE_REQUEST => array()
        );
        foreach ($stores as $storename => $store) {
            foreach ($store['modes'] as $mode => $enabled) {
                if ($enabled && ($mode !== cache_store::MODE_SESSION || $store['supports']['searchable'])) {
                    if (empty($store['default'])) {
                        $options[$mode][$storename] = $store['name'];
                    } else {
                        $options[$mode][$storename] = get_string('store_'.$store['name'], 'cache');
                    }
                }
            }
        }

        $form->addElement('hidden', 'action', 'editmodemappings');
        $form->setType('action', PARAM_ALPHA);
        foreach ($options as $mode => $optionset) {
            $form->addElement('select', 'mode_'.$mode, get_string('mode_'.$mode, 'cache'), $optionset);
        }

        $this->add_action_buttons();
    }
1206632
public function formProperty()
    {
        if ($this->formProperty === null) {
            $this->formProperty = false;

            if ($this->objType() && $this->propertyIdent()) {
                $propertyIdent = $this->propertyIdent();

                $model = $this->modelFactory()->create($this->objType());
                if ($model->hasProperty($propertyIdent)) {
                    $this->formProperty = $model->property($propertyIdent);
                }
            }
        }

        return $this->formProperty;
    }
1103146
public function build()
    {
        if ($this->isBuild) {
            return;
        }

        $settings = $this->getObject();
        $form     = $this->formManager->get($settings->getForm());

        $this->setLabel(
            $form->getOption('settings_label') ?: sprintf(
                /*@translate*/ 'Customize enabled elements for %s',
                get_class($form)
            )
        );

        $this->add(
            array(
            'type' => 'Checkbox',
            'name' => 'isActive',
            'options' => array(
                'label' => /*@translate*/ 'Activate',
                'long_label' => /*@translate*/ 'Enables the form element customization.',
            ),
            'attributes' => array(
                'class' => 'decfs-active-toggle',
            ),
            )
        );
        $element = new DisableElementsCapableFormSettings('disableElements');
        $element->setForm($form);
        $this->add($element);

        $this->isBuild = true;
    }
750662
public function form()
    {
        $permissionModel = config('admin.database.permissions_model');
        $roleModel = config('admin.database.roles_model');

        $form = new Form(new $roleModel());

        $form->display('id', 'ID');

        $form->text('slug', trans('admin.slug'))->rules('required');
        $form->text('name', trans('admin.name'))->rules('required');
        $form->listbox('permissions', trans('admin.permissions'))->options($permissionModel::all()->pluck('name', 'id'));

        $form->display('created_at', trans('admin.created_at'));
        $form->display('updated_at', trans('admin.updated_at'));

        return $form;
    }
637862
public function build(){

        $html = '';
        if ($this->isBuildFormElement == true){
            $html .= $this->buildHeader();
        }

        $html .= $this->buildElements();

        if ($this->isBuildFormElement == true){
            $html .= "</form>";
        }

        return $html;
    }