Add form to view

@param QuickForm2 $form
@ignore
554710
public function addForm(QuickForm2 $form)
    {

        // assign array with form data
        $this->assign('form_data', $form->getFormData());
        $this->assign('element_list', $form->getElementList());
    }
80725
public function updateItemEditForm(Form $form)
    {
        $record = $this->owner->getRecord();

        if ($this->shouldDisplayAction($record)) {
            $restoreToRoot = RestoreAction::shouldRestoreToRoot($record);

            $title = $restoreToRoot
                ? _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT', 'Restore to draft at top level')
                : _t('SilverStripe\\Versioned\\RestoreAction.RESTORE', 'Restore to draft');
            $description = $restoreToRoot
                ? _t(
                    'SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT_DESC',
                    'Restore the archived version to draft as a top level item'
                )
                : _t(
                    'SilverStripe\\Versioned\\RestoreAction.RESTORE_DESC',
                    'Restore the archived version to draft'
                );

            $form->actions = FieldList::create(
                FormAction::create('doRestore', $title)
                    ->setDescription($description)
                    ->setAttribute('data-to-root', $restoreToRoot)
                    ->addExtraClass('btn-warning font-icon-back-in-time ArchiveAdmin__action--restore')
                    ->setUseButtonTag(true)
            );

            $form->unsetValidator();
        }
    }
794270
protected function addQueryFields($form, $options)
    {
        $form->add('query');
        $form->add('fields', WidgetFieldsFormType::class, [
            'label'     => 'widget.form.entity.fields.label',
            'namespace' => $options['namespace'],
            'widget'    => $options['widget'],
        ]);
    }
77008
public function updateEditAccountForm($form)
    {
        // Add company name field
        $company_field = TextField::create(
            "Company",
            _t('CheckoutUsers.Company', "Company")
        );
        $company_field->setRightTitle(_t("Checkout.Optional", "Optional"));
        $form->Fields()->insertBefore($company_field, "FirstName");

        // Add contact phone number field
        $phone_field = TextField::create(
            "PhoneNumber",
            _t("CheckoutUsers.PhoneNumber", "Phone Number")
        );
        $phone_field->setRightTitle(_t("Checkout.Optional", "Optional"));
        $form->Fields()->add($phone_field);
    }
233590
protected void insertUploadForm(FormPanel form) {

        form.getElement().getStyle().setDisplay(Display.NONE);
        m_contentWrapper.add(form);
    }
918983
protected function displayLoginForm(\Gems_User_Form_LoginForm $form)
    {
        $this->setCurrentOrganizationTo($form->getUser());

        $this->view->form = $form;
    }
139591
public function render(Form $form)
    {
        $this->htmlSpecialCharsFlag = ENT_NOQUOTES;
        if (defined('ENT_HTML5')) {
            $this->htmlSpecialCharsFlag |= $this->html5 ? ENT_HTML5 : ENT_HTML401;
        }
        $this->form = $form;
        $this->form->addValues();
        return $this->renderFields($this->form->getFields());
    }
771963
public function setForm($form)
    {
        foreach ($this->fields as $field) {
            $field->setForm($form);
        }
        
        return parent::setForm($form);
    }
192983
public function render_quick_search_form(\mod_forum\output\quick_search_form $form) {
        return $this->render_from_template('mod_forum/quick_search_form', $form->export_for_template($this));
    }
1326002
public function define_form(&$form) {
        $form->addElement('header', '_commonsettings', get_string('profilecommonsettings', 'admin'));
        $this->define_form_common($form);

        $form->addElement('header', '_specificsettings', get_string('profilespecificsettings', 'admin'));
        $this->define_form_specific($form);
    }
991564
protected function loadForm()
    {
        if (! $this->_form) {
            $options = array();

            if (\MUtil_Bootstrap::enabled()) {
                //$options['class'] = 'form-horizontal';
                $options['role'] = 'form';
            }

            $this->_form = $this->createForm($options);

            $this->addFormElements($this->_form);
        }
    }
654394
public function updateEditForm($form)
    {
        if ($doadd = Config::inst()->get('ModelAdmin', 'addbetterimporters')) {
            $modelclass = $this->owner->modelClass;
            $grid = $form->Fields()->fieldByName($modelclass);
            $config =  $grid->getConfig();

            //don't proceed if there is already an importer
            if ($config->getComponentByType("GridFieldImporter")) {
                return;
            }
            //don't proceed if can't create
            if (!singleton($modelclass)->canCreate(Member::currentUser())) {
                return;
            }
            //allow config to avoid adding when there are existing importers
            $importerClasses = $this->owner->stat('model_importers');
            if (
                $doadd === "scaffolded" &&
                !is_null($importerClasses) &&
                isset($importerClasses[$modelclass])
            ) {
                return;
            }
            
            //add the component
            $config->addComponent(new GridFieldImporter('before'));
        }
    }
8830
public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $view->vars['configs'] = $options['configs']; 
        
        // Adds a custom block prefix
        array_splice(
            $view->vars['block_prefixes'],
            array_search($this->getName(), $view->vars['block_prefixes']),
            0,
            'thrace_select2'
        );
    }
445851
function traitEntity_formAddFields($form) {
        foreach ($this->traitEntity_formFields() as $k => $v) {
            if (!is_array($v)) {
                $form->{\Str::camel('add_' . $v)}($form);
            } else {
                $f = $form->putTbFieldset($k);
                foreach ($v as $field) {
                    $form->{\Str::camel('add_' . $field)}($f);
                }
            }
        }
        //        if(method_exists($this->model, 'tags')){
        //            $form->putTbSelect2('tags')->setLabel('Метки')->setDesc('Через запятую')->loadOptions(\Larakit\Model\Tag::lists('name', 'name'));
        //        }
    }
101985
public function renderElement(HTML_QuickForm2_Node $element)
    {
        $ary = $this->buildCommonFields($element) + array(
            'value'    => $element->getValue(),
            'type'     => $element->getType(),
            'required' => $element->isRequired(),
        );
        $this->pushScalar($ary);
    }
1374810
protected function addAnswersFields(FormInterface $form)
    {
        $question = $this->questionInteract->getQuestion();
        $data = $this->getQuestionData();

        /** @var AnswerCheckerInterface $checker */
        $checker = $this->checkerLocator->get($question->getType());
        $options = $checker->getOptions($question->getAnswers()->getValues(), $data);
        $form->add('answers', $checker->getType(), $options);
    }
43350
public function setupForm(&$mform) {
        $choices = array('' => get_string('anyvalue', 'filters')) + $this->_options;
        $mform->addElement('select', $this->_name, $this->_label, $choices);
        if ($this->_advanced) {
            $mform->setAdvanced($this->_name);
        }
    }