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;
	}
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;
	}
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 ; }
Formular editace uzivatele
@return Form
Formular editace uzivatele