本文整理汇总了PHP中BaseForm::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseForm::setup方法的具体用法?PHP BaseForm::setup怎么用?PHP BaseForm::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseForm
的用法示例。
在下文中一共展示了BaseForm::setup方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
public function setup()
{
$this->widgetSchema['email_address'] = new sfWidgetFormInputText();
$this->validatorSchema['email_address'] = new sfGuardValidatorUsernameOrEmail(array('trim' => true), array('required' => 'Your username or e-mail address is required.', 'invalid' => 'Username or e-mail address not found please try again.'));
$this->widgetSchema->setNameFormat('forgot_password[%s]');
parent::setup();
}
开发者ID:streamlinesocial,项目名称:sfDoctrineGuardPlugin,代码行数:7,代码来源:BasesfGuardRequestForgotPasswordForm.class.php
示例2: setup
public function setup()
{
$this->setWidgets(array('importer' => new sfWidgetFormChoice(array('choices' => self::$importers, 'expanded' => false)), 'file' => new sfWidgetFormInputFile()));
$this->setValidators(array('importer' => new sfValidatorChoice(array('choices' => array_keys(self::$importers))), 'file' => new sfValidatorFile(array('required' => true, 'max_size' => 100000, 'path' => sfConfig::get('sf_upload_dir') . '/imports', 'mime_types' => 'gps_files', 'mime_categories' => array('gps_files' => array('application/octet-stream'))))));
$this->widgetSchema->setNameFormat('import[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
parent::setup();
}
示例3: setup
public function setup()
{
$lI18n = sfContext::getInstance()->getI18N();
$this->setWidgets(array('single_code' => new sfWidgetFormInputText(), 'multiple_codes' => new sfWidgetFormTextarea()));
$this->setValidators(array('single_code' => new sfValidatorString(array("required" => false, 'trim' => true)), 'multiple_codes' => new sfValidatorString(array("required" => false, 'trim' => true))));
$this->widgetSchema->setNameFormat('coupon[%s]');
parent::setup();
}
示例4: setup
/**
* @see sfForm
*/
public function setup()
{
parent::setup();
$this->setWidgets(array('username' => new sfWidgetFormInputText(), 'password' => new sfWidgetFormInputPassword(), 'remember' => new sfWidgetFormInputCheckbox()));
$this->setValidators(array('username' => new sfValidatorString(), 'password' => new sfValidatorString(), 'remember' => new sfValidatorBoolean()));
$this->setName('signin');
$this->validatorSchema->setPostValidator(new dmValidatorUser());
}
示例5: setup
public function setup()
{
$this->setWidgets(array('Nom' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'Cognoms' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'Telefon' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'Email' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'Missatge' => new sfWidgetFormTextarea(array(), array('style' => 'width:400px'))));
$this->setValidators(array('Nom' => new sfValidatorString(), 'Cognoms' => new sfValidatorString(), 'Telefon' => new sfValidatorString(), 'Email' => new sfValidatorString(), 'Missatge' => new sfValidatorString()));
$this->widgetSchema->setLabels(array('Nom' => 'Nom: ', 'Cognoms' => 'Cognoms: ', 'Telefon' => 'Telèfon: ', 'Email' => 'Correu electrònic: ', 'Missatge' => 'Missatge: '));
$this->widgetSchema->setNameFormat('consulta[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
parent::setup();
}
示例6: setup
/**
* @see sfForm
*/
public function setup()
{
$this->setWidgets(array('username' => new sfWidgetFormInputText(), 'password' => new sfWidgetFormInputPassword(array('type' => 'password')), 'remember' => new sfWidgetFormInputCheckbox()));
$this->setValidators(array('username' => new sfValidatorString(), 'password' => new sfValidatorString(), 'remember' => new sfValidatorBoolean()));
if (sfConfig::get('app_sf_guard_plugin_allow_login_with_email', true)) {
$this->widgetSchema['username']->setLabel('Username or E-Mail');
}
$this->validatorSchema->setPostValidator(new sfGuardValidatorUser());
$this->widgetSchema->setNameFormat('signin[%s]');
parent::setup();
}
示例7: setup
public function setup()
{
$this->widgetSchema->setNameFormat('contacto[%s]');
$this->setWidget('nombre', new sfWidgetFormInput());
$this->setValidator('nombre', new sfValidatorString(array('required' => true), array('required' => 'Se requiere ingresar un nombre')));
$this->setWidget('email', new sfWidgetFormInput());
$this->setValidator('email', new sfValidatorEmail(array('required' => true), array('required' => 'Se requiere una direccion de e-mail')));
$this->setWidget('comentario', new sfWidgetFormTextarea());
$this->setValidator('comentario', new sfValidatorString(array('required' => true), array('required' => 'Se requiere un comentario')));
parent::setup();
}
示例8: setup
public function setup()
{
$typeChoices = array('' => '', 'mysql' => 'MySQL', 'sqlite' => 'Sqlite', 'pgsql' => 'PostgreSQL', 'oracle' => 'Oracle Adapter', 'oci' => 'Oracle PDO', 'mssql' => 'MsSQL');
$this->setWidgets(array('type' => new sfWidgetFormChoice(array('choices' => $typeChoices)), 'host' => new sfWidgetFormInput(), 'name' => new sfWidgetFormInput(), 'username' => new sfWidgetFormInput(), 'password' => new sfWidgetFormInputPassword()));
$this->setValidators(array('type' => new sfValidatorChoice(array('required' => false, 'choices' => array_keys($typeChoices))), 'host' => new sfValidatorString(array('required' => false)), 'name' => new sfValidatorString(array('required' => false)), 'username' => new sfValidatorString(array('required' => false)), 'password' => new sfValidatorString(array('required' => false))));
$this->widgetSchema->setLabel('name', 'Database Name');
$this->widgetSchema['password'] = new sfWidgetFormInputPassword();
$this->widgetSchema['password_again'] = new sfWidgetFormInputPassword();
$this->validatorSchema['password_again'] = clone $this->validatorSchema['password'];
$this->widgetSchema->setNameFormat('database[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')));
parent::setup();
}
示例9: setup
/**
* Overridden to allow the app to add to the form and then to process
* those additions and turn them into one giant, embedded form
*/
public function setup()
{
// allow the application to add fields to the form
self::$dispatcher->notify(new sfEvent($this, 'sympal.load_config_form'));
$otherSettings = array();
foreach ($this->_settings as $group => $settings) {
if (!is_numeric($group)) {
$form = new BaseForm();
foreach ($settings as $setting) {
$form->setWidget($setting['name'], $setting['widget']);
$form->getWidgetSchema()->setLabel($setting['name'], $setting['label']);
$form->setValidator($setting['name'], $setting['validator']);
}
$this->embedForm($group, $form);
} else {
$otherSettings[] = $settings;
}
}
foreach ($otherSettings as $setting) {
$this->setWidget($setting['name'], $setting['widget']);
$this->getWidgetSchema()->setLabel($setting['name'], $setting['label']);
$this->setValidator($setting['name'], $setting['validator']);
}
$defaults = $this->getDefaults();
foreach ($this as $key => $value) {
if ($value instanceof sfFormFieldSchema) {
foreach ($value as $k => $v) {
$defaults[$key][$k] = sfSympalConfig::get($key, $k);
}
} else {
$defaults[$key] = sfSympalConfig::get($key);
}
}
$this->setDefaults($defaults);
$this->widgetSchema->setNameFormat('settings[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
parent::setup();
}
示例10: setup
public function setup()
{
$this->setWidgets(array('email' => new sfWidgetFormInputText()));
$this->setValidators(array('email' => new sfValidatorEmail()));
parent::setup();
}