/** * @param Form $form */ protected function configure(Form $form) { $form->addGroup('Admin account'); $form->addText('name', 'Name'); $form->addPassword('password', 'Password')->setOption('description', 'minimal length is 5 char'); $form->addPassword('_password', 'Confirm password'); $form['name']->addRule($form::FILLED, 'Enter name'); $form['password']->addRule($form::FILLED, 'Enter password')->addRule($form::MIN_LENGTH, 'Password is short', 5); $form['_password']->addRule($form::EQUAL, 'Invalid re password', $form['password']); $form->setCurrentGroup(); $form->addSaveButton('Save'); }
/** * @param Form $form */ protected function configure(Form $form) { $form->addGroup('Basic settings'); $form->addSelect('driver', 'Driver')->setItems($this->drivers, false)->setDefaultValue('pdo_mysql'); $form['driver']->addCondition($form::IS_IN, array('pdo_mysql', 'oci8', 'pdo_oci'))->toggle('group-charset'); $form['driver']->addCondition($form::IS_IN, array('pdo_pgsql', 'pdo_mysql', 'oci8', 'pdo_oci', 'pdo_sqlsrv'))->toggle('group-connection'); $form['driver']->addCondition($form::EQUAL, 'pdo_sqlite')->toggle('group-sqlite'); $form->addGroup('Connection settings'); $form->addText('user', 'Username'); $form->addPassword('password', 'Password'); $form->addGroup()->setOption('id', 'group-connection'); $form->addText('host', 'Host'); $form->addText('port', 'Port')->getControlPrototype()->placeholder[] = 'default'; $form->addText('dbname', 'Database'); $form->addGroup()->setOption('id', 'group-sqlite'); $form->addTextWithSelect('path', 'Path')->setItems(array('%tempDir%/database.db'), false); $form->addCheckbox('memory', 'Db in memory'); $form->addGroup()->setOption('id', 'group-charset'); $form->addTextWithSelect('charset', 'Charset')->setItems(array('utf8'), false); $backups = $this->getBackups(); if (count($backups)) { $form->addGroup('Restore from backup'); $form->addSelect('_backup', 'Backup name', $backups)->setPrompt('--------'); } $form->setCurrentGroup(); $form->addSaveButton('Save'); }
/** * @param Form $form */ public function configure(Form $form) { $form->addText('username', 'E-mail')->setRequired('Please provide a e-mail.'); $form->addPassword('password', 'Password')->setRequired('Please provide a password.'); $form->addCheckbox('remember', 'Remember me on this computer'); $form->addSaveButton('Sign in')->getControlPrototype()->class[] = 'btn-primary'; $socialButtons = $form->addContainer('socialButtons'); foreach ($this->securityManager->getLoginProviders() as $loginProvider) { $socialButtons->addSubmit(str_replace(' ', '_', $loginProvider), $loginProvider)->setValidationScope(FALSE); } }
/** * @param Form $form */ protected function configure(Form $form) { $form->addGroup('Mailer'); $smtp = $form->addCheckbox('smtp', 'Use SMTP'); $smtp->addCondition($form::EQUAL, TRUE)->toggle('form-smtp'); $form->addGroup()->setOption('id', 'form-smtp'); $form->addText('host', 'Host')->addConditionOn($smtp, $form::EQUAL, TRUE)->addRule($form::FILLED, 'Enter host'); $form->addText('port', 'Port')->addConditionOn($smtp, $form::EQUAL, TRUE)->addCondition($form::FILLED)->addRule($form::INTEGER, 'Enter number format'); $form['port']->setOption('placeholder', '25'); $form->addSelect('secure', 'Secure', array('ssl' => 'ssl', 'tls' => 'tls'))->setPrompt('-----'); $form->addText('username', 'Username')->addConditionOn($smtp, $form::EQUAL, TRUE)->addCondition($form::FILLED)->addRule($form::EMAIL, 'Enter email address'); $form->addPassword('password', 'Password'); $form->addText('timeout', 'Timeout')->addConditionOn($smtp, $form::EQUAL, TRUE)->addCondition($form::FILLED)->addRule($form::INTEGER, 'Enter number format'); $form->setCurrentGroup(); $form->addSaveButton('Save'); }
/** * @param Form $form */ public function configure(Form $form) { $form->addPassword('password', 'Password')->setOption('description', 'minimal length is 5 char')->addRule(Form::FILLED, 'Enter password')->addRule(Form::MIN_LENGTH, 'Password is short', 5); $form->addPassword('password_confirm', 'Confirm password')->addRule(Form::EQUAL, 'Invalid re password', $form['password']); $form->addSaveButton('Reset password')->getControlPrototype()->class[] = 'btn-primary'; }