Create form elements.

@return $this
481308
public function createForm() : FormInterface
    {
        foreach ($this->value as $key => $val) {
            if (in_array($val['type'], $this->validMethods)) {
                $method = $val['type'];
                unset($val['type']);
                (!method_exists($this, $method)) ?: $this->{$method}($key, $val);
            } else {
                $this->input($key, $val);
            }

            if (isset($val['type']) && in_array($val['type'], $this->validArray)) {
                $this->setValidationError($key, $val);
            } elseif (!isset($val['type']) && in_array($method, $this->validArray)) {
                $this->setValidationError($key, $val);
            }
        }

        return $this;
    }
1340829
protected function InitForm()
    {
        $this->checkbox = $this->LoadElement();
        $this->AddRequiredField();
        $this->AddNameField();
        $this->AddLabelField();
        $this->AddCheckedField();
        $this->AddCheckedValueField();
        $this->AddDisableFrontendValidationField();
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }
755778
protected function createComponentSignInForm(): Form
	{
		$form = $this->formFactory->create();
		$form->addProtection();

		$form->addText('username', 'cms.user.username')
			->setAttribute('autofocus', true)
			->setRequired();

		$form->addPassword('password', 'cms.user.password')
			->setRequired();

		$form->addCheckbox('remember', 'cms.user.staySignedIn');

		$form->addSubmit('send', 'cms.user.signIn');

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

		return $form;
	}
644673
public function loadDefaultElements()
    {
        $this->getOrganizationElement();
        $this->getUserNameElement();
        $this->getSubmitButton();
        $this->getLoginLinkElement();

        return $this;
    }
699078
public function create()
	{
		// The highlight select field
		if ($this->canChangeHighlight)
		{
			$this->generateDCA('highlight', array
			(
				'inputType'			=> 'select',
				'label'				=> &$GLOBALS['TL_LANG']['tl_content']['highlight'],
				'options'			=> array('HTML', 'HTML5', 'XML', 'JavaScript', 'CSS', 'SCSS', 'PHP', 'JSON', 'Markdown'),
				'eval'				=> array
				(
					'includeBlankOption'	=> true,
					'submitOnChange'		=> true,
					'tl_class'				=> 'w50 clr'
				),
			));		
		}

		// The code text area
		$this->generateDCA('text', array
		(
			'inputType' 	=>	'textarea',
			'label'			=>	array($this->label, $this->description),
			'eval'			=>	array
			(
				'mandatory'		=>	($this->mandatory) ? true : false, 
				'tl_class'		=> 	'clr',
				'rte'			=>	'ace|' . (($this->highlight) ? strtolower($this->highlight) : 'text'),
				'preserveTags'	=>	true,
			),
			'load_callback'		=> (!$this->canChangeHighlight) ?: array
			(
				array('tl_content_elements', 'setAceCodeHighlighting'),
			),
		));
	}
792725
protected function _prepareForm()
    {
        $form = new Varien_Data_Form(array(
            'id' => 'edit_form',
            'action' => $this->getData('action'),
            'method' => 'post'
        ));
        $form->setUseContainer(true);
        $this->setForm($form);
        return parent::_prepareForm();
    }
841279
public function initElements()
	{
		//create the element to select the import format
		$formatElt = tao_helpers_form_FormFactory::getElement('importHandler', 'Radiobox');
		$formatElt->setDescription(__('Choose import format'));
		$formatElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty')); // should never happen anyway
		$importHandlerOptions= array();
		foreach ($this->importHandlers as $importHandler) {
			$importHandlerOptions[get_class($importHandler)] = $importHandler->getLabel();
		}
		$formatElt->setOptions($importHandlerOptions);
		

		$classUriElt = tao_helpers_form_FormFactory::getElement('classUri', 'Hidden');
//		$classUriElt->setValue($class->getUri());
		$this->form->addElement($classUriElt);

		$classUriElt = tao_helpers_form_FormFactory::getElement('id', 'Hidden');
		$this->form->addElement($classUriElt);
		
		$this->form->addElement($formatElt);

		if (!is_null($this->subForm)) {
//			load dynamically the method regarding the selected format
			$this->form->setElements(array_merge($this->form->getElements(), $this->subForm->getElements()));
			foreach ($this->subForm->getGroups() as $key => $group) {
				$this->form->createGroup($key,$group['title'],$group['elements'],$group['options']);
			}
		}
	}
654170
protected function buildForm()
    {
        $this->form = Yii::createObject(array_merge([
            'scenario' => $this->scenario,
            'parent_id' => $this->parent_id,
            'parentTariff' => $this->parentTariff,
            'tariff' => $this->tariff,
        ], $this->getFormOptions()));
    }
271721
public function createAction()
    {
        if ($form = $this->processForm()) {
            $this->setPageTitle(sprintf($this->_('New %s...'), $this->getTopic()));
            $this->html[] = $form;
        }
    }
1054025
protected function createComponentEditForm(): Form
	{
		$form = $this->formFactory->create();
		$form->addProtection();

		$form->addText('username', 'cms.user.username')
			->setDefaultValue($this->currentUser->username)
			->setRequired();
		$form->addText('firstName', 'cms.user.firstName')
			->setDefaultValue($this->currentUser->firstName);
		$form->addText('surname', 'cms.user.surname')
			->setDefaultValue($this->currentUser->surname);
		$form->addText('email', 'cms.user.email')
			->setDefaultValue($this->currentUser->email)
			->setRequired()
			->addRule(Form::EMAIL);
		$form->addPhone('phone', 'cms.user.phone')
			->setDefaultValue($this->currentUser->phone);

		$language = $form->addSelectUntranslated('language', 'cms.user.language', $this->localeService->allowed, 'form.none');
		if (!empty($this->currentUser->language)) {
			$locale = $this->localeService->get($this->currentUser->language);
			if ($locale) {
				$language->setDefaultValue($locale->id);
			}
		}

		$roles = $form->addMultiSelectUntranslated('roles', 'cms.permissions.roles', $this->orm->aclRoles->fetchPairs($this->user->isAllowed('dockbar.settings.permissions.superadmin', 'view')))
			->setRequired();
		try {
			$roles->setDefaultValue($this->currentUser->roles->getRawValue());
		} catch (InvalidArgumentException $ex) {

		}

		$form->addSubmit('save', 'form.save');
		$form->addLink('back', 'form.back', $this->getBacklink());

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

		return $form;
	}
57868
public function create()
    {
        $menu = $this->handler->add($this->name, $this->getAttribute('position'))
                    ->title($this->getAttribute('title'))
                    ->link($this->getAttribute('link'))
                    ->handles($this->menu['link'] ?? null);

        $this->attachIcon($menu);
        $this->handleNestedMenu();

        return $this;
    }
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();
    }
841130
public function initElements()
    {
        $mailElement = tao_helpers_form_FormFactory::getElement('userMail', 'Textbox');
        $mailElement->setDescription(__('Your mail') . '*');
        $mailElement->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty'));
        $mailElement->addValidator(tao_helpers_form_FormFactory::getValidator('Email'));
        $mailElement->setAttributes(array('autofocus' => 'autofocus'));
        
        $this->form->addElement($mailElement);
    }
915452
public function init()
    {
        //klucz
        $this->addElement((new Element\Text('key'))
                ->setLabel('form.text.key.label')
                ->setRequired()
                ->addValidator(new \Mmi\Validator\NotEmpty));

        //zawartość
        $this->addElement((new Element\Textarea('content'))
                ->setLabel('form.text.content.label'));

        //submit
        $this->addElement((new Element\Submit('submit'))
                ->setLabel('form.text.submit.label'));
    }
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;
    }
435191
public function form()
    {
        return $this->scaffoldForm()
                    ->without(['slug'])
                    ->update('parent_id', function (FormElement $element) {
                        $control = new Select('parent_id');
                        $control->setOptions(['' => '--Select--'] + pages()->lists());

                        return $element->setInput($control);
                    });
    }
985465
protected function createComponentUploadForm(): Form
	{
		$form = $this->formFactory->create();

		$form->addUpload('sql', 'cms.database.file')
			->setRequired();

		$form->addSubmit('upload', 'cms.database.upload');

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

		return $form;
	}