当前位置: 首页>>代码示例>>PHP>>正文


PHP Form::translate方法代码示例

本文整理汇总了PHP中Nette\Application\UI\Form::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::translate方法的具体用法?PHP Form::translate怎么用?PHP Form::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Application\UI\Form的用法示例。


在下文中一共展示了Form::translate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formSucceeded

 public function formSucceeded(Form $form, $values)
 {
     if ($values->remember) {
         $this->user->setExpiration('14 days', FALSE);
     } else {
         $this->user->setExpiration('20 minutes', TRUE);
     }
     try {
         $this->user->login($values->email, $values->password);
     } catch (Nette\Security\AuthenticationException $e) {
         $form->addError($form->translate('errors.wrong_login'));
     }
 }
开发者ID:DIPcom,项目名称:Sandmin,代码行数:13,代码来源:SignFormFactory.php

示例2: editInfo

 /**
  * 
  * @param integer $id
  * @return Form
  */
 public function editInfo($id)
 {
     $this->user_id = $id;
     $user = $this->user_manager->getUser($id);
     $form = new Form();
     $form->enableLocalized();
     $form->addText('name')->setValue($user->name)->setRequired('errors.fill_user_name')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'user_name');
     $form->addText('email')->setValue($user->email)->setRequired('errors.fill_email')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'email')->addRule(Form::EMAIL, 'errors.fill_email_success')->addRule($this->checkEmailUpdate, 'errros.email_used');
     $form->addSelect('role', $form->translate('role'), $this->getListRoles())->setAttribute('class', 'form-control')->setValue($user->user_roles_id)->setRequired('errors.field_required')->setTranslator(null);
     $form->addUpload('img')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'user_name')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'errors.img');
     $form->addSubmit('submit', 'edit')->setAttribute('class', 'btn btn-primary btn-purple btn-flat');
     $form->onSuccess[] = $this->success_form_info;
     return $form;
 }
开发者ID:DIPcom,项目名称:Sandmin,代码行数:19,代码来源:AdminEditUserFactory.php

示例3: create

 public function create()
 {
     $form = new Form();
     $form->enableLocalized();
     $form->addText('username')->setRequired('errors.fill_user_name')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'user_name');
     $form->addUpload('img')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'img')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'errors.img');
     $form->addText('email')->setRequired('errors.fill_email')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'email')->addRule(Form::EMAIL, 'errors.fill_email_success')->addRule($this->checkEmail, 'errors.email_used');
     $form->addSelect('role', $form->translate('role'), $this->getRoleList())->setRequired('errors.role')->setTranslator(null)->setAttribute('class', 'form-control');
     $form->addPassword('password')->setRequired('errors.enter_password')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'password');
     $form->addPassword('password2')->setRequired('errors.enter_password_retry')->setAttribute('class', 'form-control')->addRule(Form::EQUAL, 'errors.password_must_match', $form['password'])->setAttribute('placeholder', 'password_retry');
     $form->addSubmit('submit', 'register')->setAttribute('class', 'btn btn-primary btn-purple btn-flat');
     $form->onSuccess[] = $this->success_form_add;
     return $form;
 }
开发者ID:DIPcom,项目名称:Sandmin,代码行数:14,代码来源:AddUserFactory.php


注:本文中的Nette\Application\UI\Form::translate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。