Short description of method initForm

@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return mixed
436696
public function initForm()
    {
        

    	$this->form = new tao_helpers_form_xhtml_Form('export');

		$this->form->setDecorators(array(
			'element'			=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div')),
			'group'				=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-group')),
			'error'				=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-error ui-state-error ui-corner-all')),
			'actions-bottom'	=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-toolbar')),
			'actions-top'		=> new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-toolbar'))
		));

    	$exportElt = tao_helpers_form_FormFactory::getElement('export', 'Free');
		$exportElt->setValue('<a href="#" class="form-submitter btn-success small"><span class="icon-export"></span> ' .__('Export').'</a>');

		$this->form->setActions(array($exportElt), 'bottom');
        
    }
1126542
protected function Init()
    {
        $select = ContentSelect::Schema()->ByContent($this->Content());
        $disableValidation = $select->GetDisableFrontendValidation();
        $this->label = $select->GetLabel();
        $this->name = $select->GetName();
        $this->required = $disableValidation ? false : $select->GetRequired();
        $this->value = $this->Value($this->name, $select->GetValue());
        $this->id = $this->CssID() ? $this->CssID(): $this->name;
        $list = new SelectListProvider($select);
        $this->options = $list->ToArray();
        $this->RealizeField($this->name);
        return parent::Init();
    }
259434
protected function createComponentEditForm(): Form
	{
		$form = $this->formFactory->create();

		$form->addText('name', 'default.name')
			->setRequired();

		if ($this->editConst) {
			$form->addText('const', 'webManager.web.content.const')
				->setRequired();

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

		$form->addText('title', 'webManager.web.content.contentTitle')
			->addRule(Form::MAX_LENGTH, null, 150)
			->setRequired(false);

		$form->addTextArea('keywords', 'webManager.web.content.keywords');

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

		$form->addColor('background', 'webManager.web.content.background');

		$form->addTextArea('description', 'webManager.web.content.description');

		$form->addTextEditor('content', 'webManager.web.content.content');

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

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

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

		return $form;
	}
216494
public function init()
    {
        $this->registerMyJs();
        $display_none = '';

        if (ArrayHelper::remove($this->options, 'displayNone', true) === true) {
            $display_none = Yii::$app->request->get($this->model->formName())['search_form'] ? '' : 'display:none';
        }

        if ($this->submitButtonWrapperOptions !== false) {
            $this->submitButtonWrapperOptions = ArrayHelper::merge([
                'class' => 'col-md-12',
            ], $this->submitButtonWrapperOptions);
        }

        $tag = ArrayHelper::remove($this->options, 'tag', 'div');
        echo Html::beginTag($tag, ArrayHelper::merge([
            'id'    => $this->getDivId(),
            'class' => 'row',
            'style' => 'margin-bottom: 1rem; margin-top: 1rem; ' . $display_none,
        ], $this->options));

        $this->_form = ActiveForm::begin([
            'id'        => 'form-' . $this->getDivId(),
            'action'    => $this->action,
            'method'    => $this->method,
            'options'   => $this->formOptions,
            'fieldClass' => AdvancedSearchActiveField::class,
        ]);
        echo Html::hiddenInput(Html::getInputName($this->model, 'search_form'), 1);
    }
950783
protected function initElements()
    {
        
        
    	parent::initElements();
    	
    	$elements = $this->form->getElements();
    	$this->form->setElements(array());
    	
    	
    	$currentLangElt = tao_helpers_form_FormFactory::getElement('current_lang', 'Textbox');
		$currentLangElt->setDescription(__('Current language'));
		$currentLangElt->setAttributes(array('readonly' => 'true'));
		$currentLangElt->setValue(\common_session_SessionManager::getSession()->getDataLanguage());	//API lang /data lang
		$this->form->addElement($currentLangElt);
		
		$dataLangElement = tao_helpers_form_FormFactory::getElement('translate_lang', 'Combobox');
		$dataLangElement->setDescription(__('Translate to'));
		$dataLangElement->setOptions(tao_helpers_I18n::getAvailableLangsByUsage(new core_kernel_classes_Resource(tao_models_classes_LanguageService::INSTANCE_LANGUAGE_USAGE_DATA)));
		$dataLangElement->setEmptyOption(__('Select a language'));
		$dataLangElement->addValidator( tao_helpers_form_FormFactory::getValidator('NotEmpty') );
		$this->form->addElement($dataLangElement);
		
		$this->form->createGroup('translation_info', __('Translation parameters'), array('current_lang', 'translate_lang'));
    	
		$dataGroup = array();
		foreach($elements as $element){
			
			if( $element instanceof tao_helpers_form_elements_Hidden ||
				$element->getName() == 'uri' || $element->getName() == 'classUri'){
					
				$this->form->addElement($element);
				
			}
			else{
				
				$propertyUri = tao_helpers_Uri::decode($element->getName());
				$property = new core_kernel_classes_Property($propertyUri);
				
				//translate only language dependent properties or Labels
				//supported widget are: Textbox, TextArea, HtmlArea
				//@todo support other widgets
				if(	( $property->isLgDependent() && 
					  ($element instanceof tao_helpers_form_elements_Textbox ||
					   $element instanceof tao_helpers_form_elements_TextArea ||
					   $element instanceof tao_helpers_form_elements_HtmlArea
					  ) ) ||
					$propertyUri == OntologyRdfs::RDFS_LABEL){
				
					$translatedElt = clone $element;
					
					$viewElt = tao_helpers_form_FormFactory::getElement('view_'.$element->getName(), 'Label');
					$viewElt->setDescription($element->getDescription());
					$viewElt->setValue($element->getValue());
					$viewElt->setAttribute('no-format', true);
					if ($element instanceof tao_helpers_form_elements_HtmlArea){
						$viewElt->setAttribute('htmlentities', false);
					}
					
					$this->form->addElement($viewElt);
					
					$dataGroup[] = $viewElt->getName();
					
					$translatedElt->setDescription(' ');
					$translatedElt->setValue('');
					if($propertyUri == OntologyRdfs::RDFS_LABEL){
						$translatedElt->setForcedValid();
					}
				
					$this->form->addElement($translatedElt);
					
					$dataGroup[] = $translatedElt->getName();
				}
			}
		}
		
		$this->form->createGroup('translation_form', __('Translate'), $dataGroup);
		
        
    }
888352
public function init() {

		parent::init();

		// Views
		$this->setViewPath( '@cmsgears/module-cms/admin/views/form' );

		// Permission
		$this->crudPermission = FormsGlobal::PERM_FORM_ADMIN;

		// Config
		$this->type			= CoreGlobal::TYPE_FORM;
		$this->templateType	= CoreGlobal::TYPE_FORM;
		$this->apixBase		= 'cms/form';

		// Services
		$this->modelService		= Yii::$app->factory->get( 'formService' );
		$this->templateService	= Yii::$app->factory->get( 'templateService' );

		$this->modelContentService	= Yii::$app->factory->get( 'modelContentService' );

		// Sidebar
		$this->sidebar = [ 'parent' => 'sidebar-form', 'child' => 'form' ];

		// Return Url
		$this->returnUrl = Url::previous( 'forms' );
		$this->returnUrl = isset( $this->returnUrl ) ? $this->returnUrl : Url::toRoute( [ '/cms/form/all' ], true );

		// Breadcrumbs
		$this->breadcrumbs	= [
			'base' => [
				[ 'label' => 'Home', 'url' => Url::toRoute( '/dashboard' ) ]
			],
			'all' => [ [ 'label' => 'Forms' ] ],
			'create' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Add' ] ],
			'update' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Update' ] ],
			'delete' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Delete' ] ],
			'gallery' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Gallery' ] ],
			'data' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Data' ] ],
			'config' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Config' ] ],
			'settings' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Settings' ] ]
		];
	}
1073577
public function initialize()
    {
        if ($this->initialized) {
            return;
        }

        $this->initialized = true;
        $this->repository = app(RepositoryInterface::class);
        $this->repository->setClass($this->class);

        $model = $this->makeModel();
        parent::setModel($model);
        $this->getButtons()->setModel($model);

        parent::initialize();

        if (! $this->hasHtmlAttribute('enctype')) {

            // Recursive iterate subset of form elements
            // and if subset contains an upload element then add to for
            $this->recursiveIterateElements(function ($element) {
                if ($element instanceof Upload) {
                    $this->withFiles();

                    return true;
                }
            });
        }

        $this->getButtons()->setModelConfiguration(
            $this->getModelConfiguration()
        );
    }
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;
	}
1202384
public function form()
    {
        $this->breadcrumb->onForm();
        $all  = $this->prepare();
        $this->roundRobin->build();
        $form = $this->form->of("antares.tester: test", function (FormGrid $form) use ($all) {
            $model = new Fluent([]);
            $form->setup($this, "antares::tools/tester/prepare", $model, ['id' => 'tester-form']);
            $form->name('Module tester');
            foreach ($all as $module => $tests) {
                $form->fieldset($module, function (Fieldset $fieldset) use ($tests) {
                    $fieldset->control('input:text', '', function($control) use($tests) {
                        $control->field = function() use($tests) {
                            return view('antares/tester::admin.partials._module', ['tests' => $tests]);
                        };
                    });
                });
            }
            $form->layout('antares/tester::admin.partials._form');
        });

        $form->grid->submit = trans('Start testing');
        return $form;
    }
193340
protected function InitForm()
    {
        $this->htmlCode = $this->LoadElement();
        $name = 'Code';
        $this->AddField(new Textarea($name, $this->htmlCode->GetCode()));
        $this->SetRequired($name);
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddSubmit();
    }
1123244
public function formAction()
    {
        $isNew     = 'new' == $this->params('mode');
        $form      = $this->formManager->get('Auth/Group', array('mode' => $this->params('mode')));
        $repository = $this->repositories->get('Auth/Group');
        
        if ($isNew) {
            $group = new \Auth\Entity\Group();
        } else {
            if ($this->getRequest()->isPost()) {
                $data = $this->params()->fromPost('data');
                $id   = isset($data['id']) ? $data['id'] : false;
            } else {
                $id   = $this->params()->fromQuery('id', false);
            }
            if (!$id) {
                throw new \RuntimeException('No id.');
            }
            $group = $repository->find($id);
        }
        
        $form->bind($group);
        if ($this->getRequest()->isPost()) {
            $form->setData($_POST);
            $isOk      = $form->isValid();
            $isUsersOk = !empty($group->users);
             
            if ($isOk) {
                // We have to check here, if there are any users provided
                // as InputFilter does not allow "required" to be set on fieldsets.
                if ($isUsersOk) {
                    if ($isNew) {
                        $user    = $this->auth()->getUser();
                        $group->setOwner($user);
                        $groups  = $user->getGroups();
                        $message = /*@translate*/ 'Group created';
                        $groups->add($group);
                    } else {
                        $message = /*@translate*/ 'Group updated';
                    }
                    
                    $this->notification()->success($message);
                    return $this->redirect()->toRoute('lang/my-groups');
                }
            }
            if (!$isUsersOk) {
                $form->get('data')->get('users')->setNoUsersError(true);
            }
            $this->notification()->error(/*@translate*/ 'Changes not saved.');
        }
        
        return array(
            'form' => $form,
            'isNew' => $isNew,
        );
    }
821225
protected function buildForm()
    {
        if ($this->form) {
            return;
        }

        // append parent object if any
        // todo : clean the way the Admin class can retrieve set the object
        if ($this->isChild() && $this->getParentAssociationMapping()) {
            $parent = $this->getParent()->getObject($this->request->get($this->getParent()->getIdParameter()));

            $propertyAccessor = $this->getConfigurationPool()->getPropertyAccessor();
            $propertyPath = new PropertyPath($this->getParentAssociationMapping());

            $object = $this->getSubject();

            $value = $propertyAccessor->getValue($object, $propertyPath);

            if (\is_array($value) || ($value instanceof \Traversable && $value instanceof \ArrayAccess)) {
                $value[] = $parent;
                $propertyAccessor->setValue($object, $propertyPath, $value);
            } else {
                $propertyAccessor->setValue($object, $propertyPath, $parent);
            }
        }

        $formBuilder = $this->getFormBuilder();
        $formBuilder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
            $this->preValidate($event->getData());
        }, 100);

        $this->form = $formBuilder->getForm();
    }
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');
        
    }
716960
protected function InitForm()
    {
        $this->select  = $this->LoadElement();
        
        $this->AddNameField();
        $this->AddValueField();
        $this->AddLabelField();
        $this->AddOptionsField();
        
        $this->AddDisableFrontendValidationField();
        $this->AddRequiredField();
        $this->AddTemplateField();
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddSubmit();
    }
926099
public function init() {
        global $PAGE, $DB;

        $result = new workshop_allocation_result($this);

        $customdata = array();
        $customdata['workshop'] = $this->workshop;

        $current = $DB->get_record('workshopallocation_scheduled',
            array('workshopid' => $this->workshop->id), '*', IGNORE_MISSING);

        $customdata['current'] = $current;

        $this->mform = new workshop_scheduled_allocator_form($PAGE->url, $customdata);

        if ($this->mform->is_cancelled()) {
            redirect($this->workshop->view_url());
        } else if ($settings = $this->mform->get_data()) {
            if (empty($settings->enablescheduled)) {
                $enabled = false;
            } else {
                $enabled = true;
            }
            if (empty($settings->reenablescheduled)) {
                $reset = false;
            } else {
                $reset = true;
            }
            $settings = workshop_random_allocator_setting::instance_from_object($settings);
            $this->store_settings($enabled, $reset, $settings, $result);
            if ($enabled) {
                $msg = get_string('resultenabled', 'workshopallocation_scheduled');
            } else {
                $msg = get_string('resultdisabled', 'workshopallocation_scheduled');
            }
            $result->set_status(workshop_allocation_result::STATUS_CONFIGURED, $msg);
            return $result;
        } else {
            // this branch is executed if the form is submitted but the data
            // doesn't validate and the form should be redisplayed
            // or on the first display of the form.

            if ($current !== false) {
                $data = workshop_random_allocator_setting::instance_from_text($current->settings);
                $data->enablescheduled = $current->enabled;
                $this->mform->set_data($data);
            }

            $result->set_status(workshop_allocation_result::STATUS_VOID);
            return $result;
        }
    }
232831
public function Form()
    {
        $form = UserForm::create($this, 'Form_' . $this->ID);
        /** @skipUpgrade */
        $form->setFormAction(Controller::join_links($this->Link(), 'Form'));
        $this->generateConditionalJavascript();
        return $form;
    }
495807
public function initForm()
    {
        $this->form = tao_helpers_form_FormFactory::getForm('loginForm');

        $connectElt = tao_helpers_form_FormFactory::getElement('connect', 'Submit');
        $connectElt->setValue(__('Log in'));
        $connectElt->setAttributes(array('disabled' => 'disabled'));
        $connectElt->addClass('disabled');
        $this->form->setActions(array($connectElt), 'bottom');
    }