protected function createComponentAddForm(): Form
	{
		$form = $this->formFactory->create();
		$form->addProtection();

		$form->addText('username', 'cms.user.username')
			->setRequired();
		$form->addText('firstName', 'cms.user.firstName');
		$form->addText('surname', 'cms.user.surname');
		$form->addText('email', 'cms.user.email')
			->setRequired()
			->addRule(Form::EMAIL);
		$form->addPhone('phone', 'cms.user.phone');
		$form->addSelectUntranslated('language', 'cms.user.language', $this->localeService->allowed, 'form.none');

		$form->addMultiSelectUntranslated('roles', 'cms.permissions.roles', $this->orm->aclRoles->fetchPairs($this->user->isAllowed('dockbar.settings.permissions.superadmin', 'view')))
			->setRequired();

		if ($this->configurator->sendNewUserPassword) {
			$form->addCheckbox('generatePassword', 'cms.user.generatePassword')
				->addCondition($form::EQUAL, false)
				->toggle('password')
				->toggle('passwordVerify');
		} else {
			$form->addHidden('generatePassword', false);
		}

		$form->addPassword('password', 'cms.user.newPassword')
			->setOption('id', 'password')
			->addConditionOn($form['generatePassword'], Form::EQUAL, false)
			->setRequired()
			->addRule(Form::MIN_LENGTH, null, $this->minPasswordLength)
			->endCondition();
		$form->addPassword('passwordVerify', 'cms.user.passwordVerify')
			->setOption('id', 'passwordVerify')
			->addConditionOn($form['generatePassword'], Form::EQUAL, false)
			->setRequired()
			->addRule(Form::EQUAL, null, $form['password'])
			->endCondition();

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

		$form->onSuccess[] = [$this, 'addFormSucceeded'];
		return $form;
	}
protected function createComponentAddForm(): Form
	{
		$form = $this->formFactory->create();
		$form->addProtection();

		$form->addText('username', 'cms.user.username')
			->setRequired();
		$form->addText('firstName', 'cms.user.firstName');
		$form->addText('surname', 'cms.user.surname');
		$form->addText('email', 'cms.user.email')
			->setRequired()
			->addRule(Form::EMAIL);
		$form->addPhone('phone', 'cms.user.phone');
		$form->addSelectUntranslated('language', 'cms.user.language', $this->localeService->allowed, 'form.none');

		$form->addMultiSelectUntranslated('roles', 'cms.permissions.roles', $this->orm->aclRoles->fetchPairs($this->user->isAllowed('dockbar.settings.permissions.superadmin', 'view')))
			->setRequired();

		if ($this->configurator->sendNewUserPassword) {
			$form->addCheckbox('generatePassword', 'cms.user.generatePassword')
				->addCondition($form::EQUAL, false)
				->toggle('password')
				->toggle('passwordVerify');
		} else {
			$form->addHidden('generatePassword', false);
		}

		$form->addPassword('password', 'cms.user.newPassword')
			->setOption('id', 'password')
			->addConditionOn($form['generatePassword'], Form::EQUAL, false)
			->setRequired()
			->addRule(Form::MIN_LENGTH, null, $this->minPasswordLength)
			->endCondition();
		$form->addPassword('passwordVerify', 'cms.user.passwordVerify')
			->setOption('id', 'passwordVerify')
			->addConditionOn($form['generatePassword'], Form::EQUAL, false)
			->setRequired()
			->addRule(Form::EQUAL, null, $form['password'])
			->endCondition();

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

		$form->onSuccess[] = [$this, 'addFormSucceeded'];
		return $form;
	}
protected function createComponentAddForm ( ) : Form { $ form = $ this -> formFactory -> create ( ) ; $ form -> addProtection ( ) ; $ form -> addText ( 'username' , 'cms.user.username' ) -> setRequired ( ) ; $ form -> addText ( 'firstName' , 'cms.user.firstName' ) ; $ form -> addText ( 'surname' , 'cms.user.surname' ) ; $ form -> addText ( 'email' , 'cms.user.email' ) -> setRequired ( ) -> addRule ( Form :: EMAIL ) ; $ form -> addPhone ( 'phone' , 'cms.user.phone' ) ; $ form -> addSelectUntranslated ( 'language' , 'cms.user.language' , $ this -> localeService -> allowed , 'form.none' ) ; $ form -> addMultiSelectUntranslated ( 'roles' , 'cms.permissions.roles' , $ this -> orm -> aclRoles -> fetchPairs ( $ this -> user -> isAllowed ( 'dockbar.settings.permissions.superadmin' , 'view' ) ) ) -> setRequired ( ) ; if ( $ this -> configurator -> sendNewUserPassword ) { $ form -> addCheckbox ( 'generatePassword' , 'cms.user.generatePassword' ) -> addCondition ( $ form :: EQUAL , false ) -> toggle ( 'password' ) -> toggle ( 'passwordVerify' ) ; } else { $ form -> addHidden ( 'generatePassword' , false ) ; } $ form -> addPassword ( 'password' , 'cms.user.newPassword' ) -> setOption ( 'id' , 'password' ) -> addConditionOn ( $ form [ 'generatePassword' ] , Form :: EQUAL , false ) -> setRequired ( ) -> addRule ( Form :: MIN_LENGTH , null , $ this -> minPasswordLength ) -> endCondition ( ) ; $ form -> addPassword ( 'passwordVerify' , 'cms.user.passwordVerify' ) -> setOption ( 'id' , 'passwordVerify' ) -> addConditionOn ( $ form [ 'generatePassword' ] , Form :: EQUAL , false ) -> setRequired ( ) -> addRule ( Form :: EQUAL , null , $ form [ 'password' ] ) -> endCondition ( ) ; $ form -> addSubmit ( 'save' , 'form.save' ) ; $ form -> addLink ( 'back' , 'form.back' , $ this -> getBacklink ( ) ) ; $ form -> onSuccess [ ] = [ $ this , 'addFormSucceeded' ] ; return $ form ; }
Formular pridani uzivatele
@return Form
Formular pridani uzivatele