Used to create the form elements and bind them to the form instance

@access protected
@return mixed
175553
protected function initElements()
    {
        //create date picker elements
        $fromDateElt = \tao_helpers_form_FormFactory::getElement('from', 'calendar');
        $fromDateElt->setDescription(__('Start date of the export'));


        $toDateElt = \tao_helpers_form_FormFactory::getElement('to', 'calendar');
        $toDateElt->setDescription(__('End date of the export'));
        $toDateElt->setValue(time());

        $this->form->addElement($fromDateElt);
        $this->form->addElement($toDateElt);

        if (!is_null($this->instanceUri)) {
            $instanceElt = \tao_helpers_form_FormFactory::getElement('uri', 'Hidden');
            $instanceElt->setValue($this->instanceUri);
            $this->form->addElement($instanceElt);
        }

    }
506492
protected function initForm()
    {
    	(isset($this->options['name'])) ? $name = $this->options['name'] : $name = ''; 
    	if(empty($name)){
			$name = 'form_'.(count(self::$forms)+1);
		}
		unset($this->options['name']);
			
		$this->form = \tao_helpers_form_FormFactory::getForm($name, $this->options);
		
		//create action in toolbar
		$createElt = \tao_helpers_form_FormFactory::getElement('create', 'Free');
		$createElt->setValue('<button class="btn-info" type="submit" id="addButton">'.\tao_helpers_Icon::iconAdd().__('Create').'</button>');
		$this->form->setActions(array(), 'top');
		$this->form->setActions(array($createElt), 'bottom');
    }
749538
private function build() {

        $this -> fill();

        $html = '<input type="'. $this -> type .'"';
        
        foreach($this -> attributes as $attribute => $value) {
            $html .= ' ' . $attribute . '="'. Escape :: attr($value) .'"';
        }

        $html .= '>';

        return $html;
    }
1159431
protected function _prepareForm()
    {
        $form = $this->formFactory->create();
        $this->setForm($form);

        /** @var \Mirasvit\Blog\Model\Post $post */
        $post = $this->registry->registry('current_model');

        $fieldset = $form->addFieldset('edit_fieldset', [
            'class' => 'blog__post-fieldset'
        ]);

        if ($post->getId()) {
            $fieldset->addField('entity_id', 'hidden', [
                'name'  => 'post[entity_id]',
                'value' => $post->getId(),
            ]);
        }

        $fieldset->addField('name', 'text', [
            'label'    => __('Title'),
            'name'     => 'post[name]',
            'value'    => $post->getName(),
            'required' => true,
        ]);

        $editorConfig = $this->wysiwygConfig->getConfig(['tab_id' => $this->getTabId()]);

        $fieldset->addField('content', 'editor', [
            'name'    => 'post[content]',
            'value'   => $post->getContent(),
            'wysiwyg' => true,
            'style'   => 'height:35em',
            'config'  => $editorConfig,
        ]);

        $fieldset->addField('short_content', 'editor', [
            'label'   => __('Excerpt'),
            'name'    => 'post[short_content]',
            'value'   => $post->getShortContent(),
            'wysiwyg' => true,
            'style'   => 'height:5em',
            'config'  => $editorConfig
        ]);


        return parent::_prepareForm();
    }
666086
protected function initForm()
    {
		$this->form = \tao_helpers_form_FormFactory::getForm('roleDebug');
		
		$action = \tao_helpers_form_FormFactory::getElement('save', 'Free');
		$action->setValue('<button class="btn-info form-submiter" type="button" id="addButton"><span class="icon-tools"></span>'.__('Restrict').'</button>');
		
		
		$this->form->setActions(array(), 'top');
		$this->form->setActions(array($action), 'bottom');
    }
102452
final public function init()
    {
        $sm = $this->getServiceLocator();
        $config = $sm->get($this->moduleService)->config();
        if (array_key_exists('*', $config)) {
            // Inject form instance if * is closure
            if (is_object($config['*']) && $config['*'] instanceof \Closure) {
                $form = $config['*']($this);
            }
        }
        $this->initialize();
        // Initialize form elements
        foreach ($this->getFormElements() as $element) {
            $elementOptions = array();
            if (array_key_exists($element['name'], $this->formElementOptions)) {
                $elementOptions = $this->formElementOptions[$element['name']];
            }
            // Add id attribute for each element
            if (!array_key_exists('attributes', $element)) {
                $element['attributes'] = array();
                $element['attributes'] ['id'] = $element['name'];
            } else {
                $element['attributes'] ['id'] = $element['name'];
            }
            $this->add($element, $elementOptions);
        }
        return $this;
    }
1277855
protected function InitForm()
    {
        $this->submit = $this->LoadElement();
        
        $this->AddNameField();
        $this->AddValueField();
        
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }
810382
protected function _getSelectForm()
    {
        $form = new \Gems_Form(array('name' => 'autosubmit', 'class' => 'form-inline', 'role' => 'form'));

        $form->setHtml('div');
        $div = $form->getHtml();
        $div->class = 'search';

        $span = $div->div(array('class' => 'panel panel-default'))->div(array('class' => 'inputgroup panel-body'));

        $element = $form->createElement('select', 'gpa_level', array(
            'multiOptions' => $this->patchLevels,
            'onchange' => 'this.form.submit();',
            'onkeyup' => 'this.form.submit();',
            ));

        $element->setValue($this->getPatchLevel());
        $span->input($element);

        $form->addElement($element);

        $submit = $form->createElement('submit', 'search', array(
            'label' => $this->_('Search'),
            'class' => 'button small',
            ));

        $span->input($submit);
        $form->addElement($submit);

        return $form;
    }
491699
protected function getInput()
	{
		// Initialize variables.
		$options = array();
		$attr = '';

		// Initialize some field attributes.
		$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
		$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
		$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
		$attr .= $this->multiple ? ' multiple="multiple"' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

		// Iterate through the children and build an array of options.
		foreach ($this->element->children() as $option)
		{

			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			// Create a new option object based on the <option /> element.
			$tmp = Dropdown::option((string) $option['value'], trim((string) $option), 'value', 'text',
				((string) $option['disabled'] == 'true')
			);

			// Set some option attributes.
			$tmp->class = (string) $option['class'];

			// Set some JavaScript option attributes.
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		return Access::usergroup($this->name, $this->value, $attr, $options, $this->id);
	}
62185
public function makeInput()
    {
        $options = $this->getFormattedOptions();
        $html = '<input'.$this->html->getElementAttributes($options). '>';
        $html = $this->makeElement($options, $html);
        return $html;
    }
23402
public function init()
    {
        $this->attributes['type'] = $this->type;
        echo Html::beginForm($this->action, $this->method, $this->attributes);

        return new Form;
    }
271967
protected function _prepareForm()
    {
        $form = $this->formFactory->create();
        $this->setForm($form);

        /** @var \Mirasvit\Blog\Model\Category $category */
        $category = $this->registry->registry('current_model');

        $fieldset = $form->addFieldset('edit_fieldset', [
            'legend' => __('Search Engine Optimization')
        ]);

        $fieldset->addField('url_key', 'text', [
            'label' => __('URL Key'),
            'name'  => 'url_key',
            'value' => $category->getUrlKey(),
        ]);

        $fieldset->addField('meta_title', 'text', [
            'label' => __('Meta Title'),
            'name'  => 'meta_title',
            'value' => $category->getMetaTitle(),
        ]);

        $fieldset->addField('meta_description', 'textarea', [
            'label' => __('Meta Description'),
            'name'  => 'meta_description',
            'value' => $category->getMetaDescription(),
        ]);

        $fieldset->addField('meta_keywords', 'textarea', [
            'label' => __('Meta Keywords'),
            'name'  => 'meta_keywords',
            'value' => $category->getMetaKeywords(),
        ]);

        return parent::_prepareForm();
    }
834152
public function render()
    {
        $this->applyElementBehavior();

        $elements = [];

        if ($this->cloneElement()) {
            $originalArguments = $this->arguments();
            $originalMethods = $this->methods();

            $locales = $this->locales();
            // Check if a custom locale set is requested.
            if ($count = func_num_args()) {
                $args = ($count == 1 ? head(func_get_args()) : func_get_args());
                $locales = array_intersect($locales, (array) $args);
            }

            foreach ($locales as $locale) {
                $this->arguments($originalArguments);
                $this->methods($originalMethods);
                
                $name = str_contains($originalArguments['name'], '%locale') ? $originalArguments['name'] : '%locale[' . $originalArguments['name'] . ']';
                $this->overwriteArgument('name', str_replace('%locale', $locale, $name));
                
                if ($this->translatableIndicator()) {
                    $this->setTranslatableLabelIndicator($locale);
                }
                if (!empty($this->config['form-group-class'])) {
                    $this->addMethod('addGroupClass', str_replace('%locale', $locale, $this->config['form-group-class']));
                }
                if (!empty($this->config['input-locale-attribute'])) {
                    $this->addMethod('attribute', [$this->config['input-locale-attribute'], $locale]);
                }
                $elements[] = $this->createInput($locale);
            }
        } else {
            $elements[] = $this->createInput();
        }

        $this->reset();

        return implode('', $elements);
    }
1348027
public function create()
    {
        $model = new ModuleRow();
        $form  = $this->form($model);
        if (app('request')->isMethod('post')) {
            if (!$form->isValid()) {
                return ['errors' => $form->getMessageBag()];
            }
        }
        return ['form' => $form];
    }
969846
public function _createElements() {
        global $COURSE, $CFG, $OUTPUT;
        $attributes = $this->getAttributes();
        if (is_null($attributes)) {
            $attributes = array();
        }

        $this->_elements = array();

        // Create main elements
        // We have to create the scale and point elements first, as we need their IDs.

        // Grade scale select box.
        $scales = get_scales_menu($COURSE->id);
        $langscale = get_string('modgradetypescale', 'grades');
        $this->scaleformelement = $this->createFormElement('select', 'modgrade_scale', $langscale,
            $scales, $attributes);
        $this->scaleformelement->setHiddenLabel(true);
        $scaleformelementid = $this->generate_modgrade_subelement_id('modgrade_scale');
        $this->scaleformelement->updateAttributes(array('id' => $scaleformelementid));

        // Maximum grade textbox.
        $langmaxgrade = get_string('modgrademaxgrade', 'grades');
        $this->maxgradeformelement = $this->createFormElement('text', 'modgrade_point', $langmaxgrade, array());
        $this->maxgradeformelement->setHiddenLabel(true);
        $maxgradeformelementid = $this->generate_modgrade_subelement_id('modgrade_point');
        $this->maxgradeformelement->updateAttributes(array('id' => $maxgradeformelementid));

        // Grade type select box.
        $gradetype = array(
            'none' => get_string('modgradetypenone', 'grades'),
            'scale' => get_string('modgradetypescale', 'grades'),
            'point' => get_string('modgradetypepoint', 'grades'),
        );
        $langtype = get_string('modgradetype', 'grades');
        $this->gradetypeformelement = $this->createFormElement('select', 'modgrade_type', $langtype, $gradetype,
            $attributes, true);
        $this->gradetypeformelement->setHiddenLabel(true);
        $gradetypeformelementid = $this->generate_modgrade_subelement_id('modgrade_type');
        $this->gradetypeformelement->updateAttributes(array('id' => $gradetypeformelementid));

        if ($this->isupdate && $this->hasgrades) {
            $this->gradetypeformelement->updateAttributes(array('disabled' => 'disabled'));
            $this->scaleformelement->updateAttributes(array('disabled' => 'disabled'));

            // Check box for options for processing existing grades.
            if ($this->canrescale) {
                $langrescalegrades = get_string('modgraderescalegrades', 'grades');
                $choices = array();
                $choices[''] = get_string('choose');
                $choices['no'] = get_string('no');
                $choices['yes'] = get_string('yes');
                $rescalegradesselect = $this->createFormElement('select',
                    'modgrade_rescalegrades',
                    $langrescalegrades,
                    $choices);
                $rescalegradesselect->setHiddenLabel(true);
                $rescalegradesselectid = $this->generate_modgrade_subelement_id('modgrade_rescalegrades');
                $rescalegradesselect->updateAttributes(array('id' => $rescalegradesselectid));
            }
        }

        // Add elements.
        if ($this->isupdate && $this->hasgrades) {
            // Set a message so the user knows why they can not alter the grade type or scale.
            if ($this->currentgradetype == 'scale') {
                $gradesexistmsg = get_string('modgradecantchangegradetyporscalemsg', 'grades');
            } else if ($this->canrescale) {
                $gradesexistmsg = get_string('modgradecantchangegradetypemsg', 'grades');
            } else {
                $gradesexistmsg = get_string('modgradecantchangegradetype', 'grades');
            }

            $gradesexisthtml = '<div class=\'alert alert-warning\'>' . $gradesexistmsg . '</div>';
            $this->_elements[] = $this->createFormElement('static', 'gradesexistmsg', '', $gradesexisthtml);
        }

        // Grade type select box.
        $label = html_writer::tag('label', $this->gradetypeformelement->getLabel(),
            array('for' => $this->gradetypeformelement->getAttribute('id')));
        $this->_elements[] = $this->createFormElement('static', 'gradetypelabel', '', '&nbsp;'.$label);
        $this->_elements[] = $this->gradetypeformelement;
        $this->_elements[] = $this->createFormElement('static', 'gradetypespacer', '', '<br />');

        // Only show the grade scale select box when applicable.
        if (!$this->isupdate || !$this->hasgrades || $this->currentgradetype == 'scale') {
            $label = html_writer::tag('label', $this->scaleformelement->getLabel(),
                array('for' => $this->scaleformelement->getAttribute('id')));
            $this->_elements[] = $this->createFormElement('static', 'scalelabel', '', $label);
            $this->_elements[] = $this->scaleformelement;
            $this->_elements[] = $this->createFormElement('static', 'scalespacer', '', '<br />');
        }

        if ($this->isupdate && $this->hasgrades && $this->canrescale && $this->currentgradetype == 'point') {
            // We need to know how to apply any changes to maxgrade - ie to either update, or don't touch exising grades.
            $label = html_writer::tag('label', $rescalegradesselect->getLabel(),
                array('for' => $rescalegradesselect->getAttribute('id')));
            $labelhelp = new help_icon('modgraderescalegrades', 'grades');
            $this->_elements[] = $this->createFormElement('static', 'scalelabel', '', $label . $OUTPUT->render($labelhelp));
            $this->_elements[] = $rescalegradesselect;
            $this->_elements[] = $this->createFormElement('static', 'scalespacer', '', '<br />');
        }

        // Only show the max points form element when applicable.
        if (!$this->isupdate || !$this->hasgrades || $this->currentgradetype == 'point') {
            $label = html_writer::tag('label', $this->maxgradeformelement->getLabel(),
                array('for' => $this->maxgradeformelement->getAttribute('id')));
            $this->_elements[] = $this->createFormElement('static', 'pointlabel', '', $label);
            $this->_elements[] = $this->maxgradeformelement;
            $this->_elements[] = $this->createFormElement('static', 'pointspacer', '', '<br />');
        }
    }
1140165
public function initForm()
    {
        
        $name = isset($this->options['name']) ? $this->options['name'] : 'form_'.(count(self::$forms)+1); 
		unset($this->options['name']);
		
        $this->form = tao_helpers_form_FormFactory::getForm($name, $this->options);
    	
		//add create action in toolbar
		$action = tao_helpers_form_FormFactory::getElement('save', 'Free');
		$value =  '<a href="#" class="form-submitter btn-success small"><span class="icon-save"></span> ' .__('Create').'</a>';

		$action->setValue($value);
		
		$this->form->setActions(array($action), 'top');
		$this->form->setActions(array($action), 'bottom');
        
    }
312574
protected function createComponentEditForm(): Form
	{
		$form = $this->formFactory->create();

		$form->addHidden('parent');

		$form->addCheckbox('isLink', 'webManager.web.pages.isLink')
			->setOption('id', 'page-isLink')
			->addCondition($form::EQUAL, false)
			->toggle('page-title')
			->toggle('page-keywords')
			->toggle('page-image')
			->toggle('page-background')
			->toggle('page-description')
			->toggle('page-content')
			->toggle('page-homePage');

		$homePage = $form->addCheckbox('homePage', 'webManager.web.pages.homePage')
			->setOption('id', 'page-homePage')
			->setDisabled(!$this->editHomePage);
		$homePage->addCondition($form::EQUAL, false)
			->toggle('page-name')
			->toggle('page-url')
			->toggle('page-views')
			->toggle('page-isLink');
		if ($homePage->isDisabled()) {
			$homePage->setOption('class', 'hidden');
		}

		$form->addText('name', 'webManager.web.pages.name')
			->setOption('id', 'page-name')
			->addConditionOn($form['homePage'], $form::EQUAL, false)
			->setRequired();

		$form->addText('url', 'default.url')
			->setOption('id', 'page-url')
			->addConditionOn($form['isLink'], $form::EQUAL, true)
			->setRequired();

		$form->addSelectUntranslated('locale', 'webManager.web.pages.locale')
			->setItems($this->localeService->allowed);

		$form->addCheckboxListUntranslated('views', 'webManager.web.pages.views.title')
			->setOption('id', 'page-views')
			->setItems($this->orm->pagesViews->fetchPairsById());

		$form->addText('title', 'webManager.web.pages.pageTitle')
			->setOption('id', 'page-title')
			->setRequired(false)
			->addRule(Form::MAX_LENGTH, null, 150);

		$form->addTextArea('keywords', 'webManager.web.pages.keywords')
			->setOption('id', 'page-keywords')
			->setRequired(false)
			->addRule(Form::MAX_LENGTH, null, 255);

		$form->addImageUpload('image', 'webManager.web.pages.photo', 'webManager.web.pages.photoDelete')
			->setNamespace('pages')
			->setPreview('300x100')
			->setOption('id', 'page-image');

		$form->addColor('background', 'webManager.web.pages.background')
			->setOption('id', 'page-background');

		$form->addTextArea('description', 'webManager.web.pages.description')
			->setOption('id', 'page-description')
			->setRequired(false)
			->addRule(Form::MAX_LENGTH, null, 255);

		$form->addTextEditor('content', 'webManager.web.pages.content')
			->setOption('id', 'page-content');

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

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

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

		return $form;
	}