本文整理汇总了PHP中BaseForm::configure方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseForm::configure方法的具体用法?PHP BaseForm::configure怎么用?PHP BaseForm::configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseForm
的用法示例。
在下文中一共展示了BaseForm::configure方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
public function configure()
{
$this->setWidgets(array(
/* 'partner' => new sfWidgetFormInputText(), */
'message' => new sfWidgetFormTextarea(),
/* 'fee' => new sfWidgetFormInputText() */
));
/*
$role = new sfWidgetFormChoice(array(
'expanded' => true,
'multiple' => false,
'choices' => array('follower' => 'Follower', 'leader' => 'Leader')
)); */
/*
$this->widgetSchema['role'] = $role;
$this->setValidator('role' , new sfValidatorString(array('required' => true)));
$this->setValidators(array(
'fee' => new sfValidatorString(array('required' => true))
));
*/
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
parent::configure();
// $this->addCSRFProtection('flkd445rvvrGV34G');
$this->disableLocalCSRFProtection();
}
示例2: configure
public function configure()
{
parent::configure();
$this->setWidget('username_or_email', new sfWidgetFormInput(array(), array('maxlength' => 100)));
$this->setValidator('username_or_email', new sfValidatorOr(array(new sfValidatorAnd(array(new sfValidatorString(array('required' => true, 'trim' => true, 'min_length' => 4, 'max_length' => 16)), new sfValidatorDoctrineChoice(array('model' => 'sfGuardUser', 'column' => 'username'), array("invalid" => "There is no such user.")))), new sfValidatorEmail(array('required' => true)))));
$this->widgetSchema->setNameFormat('sfApplyResetRequest[%s]');
}
示例3: configure
public function configure()
{
$this->widgetSchema['query'] = new sfWidgetFormInputText();
$this->validatorSchema['query'] = new sfValidatorString(array('required' => true));
$this->widgetSchema->setLabels(array('query' => 'Запрос'));
parent::configure();
}
示例4: configure
public function configure()
{
$this->setWidgets(array(
'studio_id' => new sfWidgetFormDoctrineChoice(array('model' => 'dsStudio', 'add_empty' => false)),
'time' => new sfWidgetFormTime(),
'duration' => new sfWidgetFormInputText(),
'num_lessons' => new sfWidgetFormInputText(),
'start_date' => new sfWidgetFormDate(),
'teachers_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'dsTeacher')),
));
// "dateFormat" => 'd.m.yy'
$date_options = array(
'culture' => 'de',
"change_month" => true,
"change_year" => true
);
$this->widgetSchema['start_date'] = new MOvEWidgetFormDateJQueryUI( $date_options );
$time_options = array(
'can_be_empty' => true,
'format' => '%hour% : %minute%',
'hours' => array_combine( range(8,23), range(8,23)),
'minutes' => array(
0 => '00',
15 => '15',
30 => '30',
45 => '45',
)
);
$this->widgetSchema['time']= new sfWidgetFormTime($time_options);
$this->widgetSchema['teachers_list']
->setOption('renderer_class', 'sfWidgetFormSelectDoubleList' );
$this->setValidators(array(
'studio_id' => new sfValidatorDoctrineChoice(array('model' => 'dsStudio')),
'time' => new sfValidatorTime(array('required' => false)),
'duration' => new sfValidatorInteger(array('required' => false)),
'num_lessons' => new sfValidatorInteger(array('required' => false)),
'start_date' => new sfValidatorDate(array('required' => false)),
'teachers_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'dsTeacher', 'required' => false)),
));
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
parent::configure();
$this->widgetSchema->setNameFormat('ds_class_schedule[%s]');
$this->addCSRFProtection('flkd445rvvrGV34G');
}
示例5: configure
public function configure()
{
parent::configure();
$this->setWidget('title', new sfWidgetFormInputText());
$this->setValidator('title', new sfValidatorString(array('min_length' => 2, 'required' => true)));
$this->widgetSchema->setNameFormat('a_new_event[%s]');
$this->widgetSchema->setFormFormatterName('aAdmin');
}
示例6: configure
public function configure()
{
parent::configure();
$this->setWidgets(array('email' => new sfWidgetFormInput(), 'password' => new sfWidgetFormInputPassword()));
$this->setValidators(array('email' => new sfValidatorEmail(array('required' => true), array('required' => 'El email es obligatorio')), 'password' => new sfValidatorString(array('required' => true), array('required' => 'Escribe tu contraseña'))));
$this->widgetSchema->setNameFormat('login[%s]');
$this->widgetSchema->setFormFormatterName('list');
}
示例7: configure
public function configure()
{
parent::configure();
$this->setWidgets(array('email' => new sfWidgetFormInput(), 'password' => new sfWidgetFormInputPassword(), 'password2' => new sfWidgetFormInputPassword()));
$this->setValidators(array('email' => new sfValidatorEmail(array('required' => true), array('required' => "El email es obligatorio")), 'password' => new sfValidatorString(array('required' => true), array('required' => "La contraseña es obligatoria")), 'password2' => new sfValidatorString(array('required' => true), array('required' => "La contraseña es obligatoria"))));
$this->widgetSchema->setNameFormat('register[%s]');
$this->widgetSchema->setFormFormatterName('list');
$this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new sfValidatorSchemaCompare('password2', sfValidatorSchemaCompare::EQUAL, 'password', array('throw_global_error' => true), array('invalid' => "Las dos contraseñas no coinciden")), new sfValidatorDoctrineUnique(array('model' => 'User', 'column' => array('email')), array('invalid' => "Este email ya está en uso")))));
}
示例8: configure
public function configure()
{
parent::configure();
$this->setWidgets(array('cedula' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'validateregex,required', 'data-bvalidator-msg' => 'Indique su cedula de indentidad en formato V-000000')), 'producto' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'digit', 'data-bvalidator-msg' => 'Indique el identificador del producto, sólo dígitos'))));
$this->widgetSchema->setLabels(array('cedula' => 'Cedula de Identidad', 'producto' => 'Número de artículo'));
$this->widgetSchema->setNameFormat('buscaproducto[%s]');
$this->widgetSchema->setFormFormatterName('table');
$this->setValidators(array('cedula' => new sfValidatorRegex(array('pattern' => '/^(V|J)-[0-9]+$/')), 'producto' => new sfValidatorDoctrineChoice(array('model' => 'Productos', 'required' => false))));
//$this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new validatorUsuarioProducto())));
}
示例9: configure
public function configure()
{
parent::configure();
$tipos_tdc = array('visa' => '<img src="' . sfConfig::get('app_serverhost', false) . '/imagenes/icon_tdc_visa" alt="Visa"/>', 'mastercard' => '<img src="' . sfConfig::get('app_serverhost', false) . '/imagenes/icon_tdc_mastercard" alt="MasterCard"/>');
$this->setWidgets(array('email' => new sfWidgetFormInputHidden(array(), array('data-bvalidator' => 'email,required', 'data-bvalidator-msg' => 'Dirección de correo electrónico inválida.')), 'monto' => new sfWidgetFormInputHidden(array(), array('data-bvalidator' => 'number,required', 'data-bvalidator-msg' => 'Monto inválido.')), 'paquete' => new sfWidgetFormInputHidden(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Numero de paquete inválido.')), 'tipo_tdc' => new sfWidgetFormSelectRadio(array('choices' => $tipos_tdc, 'class' => 'tipo-tdc-list'), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido')), 'tdc' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido')), 'vence' => new sfWidgetFormCCExpirationDate(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido')), 'banco' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido')), 'cedula' => new sfWidgetFormInput(array(), array('data-bvalidator' => 'required', 'data-bvalidator-msg' => 'Campo requerido'))));
$this->widgetSchema->setLabels(array('tipo_tdc' => 'Tipo de Trajeta', 'tdc' => 'Número de Tarjeta', 'vence' => 'Fecha de Vencimiento', 'banco' => 'Banco Emisor', 'cedula' => 'Cedula de Identidad'));
$this->widgetSchema->setNameFormat('datospago[%s]');
$this->widgetSchema->setFormFormatterName('table');
$this->setValidators(array('email' => new sfValidatorEmail(array(), array()), 'monto' => new sfValidatorNumber(array(), array()), 'paquete' => new sfValidatorDoctrineChoice(array('model' => 'Productos'), array()), 'tipo_tdc' => new sfValidatorChoice(array('choices' => array_keys($tipos_tdc)), array()), 'tdc' => new sfValidatorCreditCardNumber(array(), array('invalid' => 'Número de tarjeta inválido')), 'vence' => new sfValidatorCCExpirationDate(), 'banco' => new sfValidatorString(array(), array()), 'cedula' => new sfValidatorString(array(), array())));
$this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new sfValidatorCreditCardType(), new sfValidatorPagoESite())));
}
示例10: configure
public function configure()
{
self::$subjects = sfConfig::get('app_feedback_subjects', array('Subject A', 'Subject B', 'Subject C'));
$this->widgetSchema->setNameFormat('feedback[%s]');
$this->setWidgets(array('name' => new sfWidgetFormInput(array(), array('placeholder' => 'First and last name')), 'email' => new sfWidgetFormInputEmail(array(), array('placeholder' => 'example@domain.com')), 'subject' => new sfWidgetFormSelect(array('choices' => self::$subjects)), 'message' => new sfWidgetFormTextarea(array(), array('placeholder' => 'Tell us what you want to say...'))));
$this->widgetSchema->setNameFormat('feedback[%s]');
$this->setValidators(array('name' => new sfValidatorString(array('required' => false)), 'email' => new sfValidatorEmail(), 'subject' => new sfValidatorChoice(array('choices' => array_keys(self::$subjects))), 'message' => new sfValidatorString(array('min_length' => 4))));
$this->widgetSchema->setLabels(array('name' => 'Your Name', 'email' => 'Your Email Address', 'subject' => 'Subject', 'message' => 'Your Message'));
if (sfConfig::get('app_recaptcha_active', false)) {
$this->setWidget('response', new sfWidgetFormInputHidden());
$this->validatorSchema->setPostValidator(new sfValidatorSchemaReCaptcha('challenge', 'response'));
$this->validatorSchema->setOption('allow_extra_fields', true);
$this->validatorSchema->setOption('filter_extra_fields', false);
}
parent::configure();
}
示例11: configure
public function configure()
{
$this->setWidgets(array(
'message' => new sfWidgetFormTextarea(),
));
$role = new sfWidgetFormChoice(array(
'expanded' => true,
'multiple' => false,
'choices' => array('follower' => 'Follower', 'leader' => 'Leader')
));
$this->widgetSchema['role'] = $role;
$this->setValidator('role' , new sfValidatorString(array('required' => true)));
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
parent::configure();
$this->addCSRFProtection('flk34Gd445rvvrGV');
}
示例12: configure
public function configure()
{
#$this->widgetSchema->setIdFormat('registration_form_%s');
$this->widgetSchema['firstname'] = new sfWidgetFormInputText();
$this->widgetSchema['lastname'] = new sfWidgetFormInputText();
$this->widgetSchema['street'] = new sfWidgetFormInputText();
$this->widgetSchema['zipcode'] = new sfWidgetFormInputText();
$this->widgetSchema['city'] = new sfWidgetFormInputText();
$this->widgetSchema['phone'] = new sfWidgetFormInputText();
$this->widgetSchema['email'] = new sfWidgetFormInput();
$this->widgetSchema['student'] = new sfWidgetFormSelectCheckbox(
array( 'choices' => array('1' => 'Ja, ich studiere / bin in Ausbildung')
));
$this->widgetSchema['partner'] = new sfWidgetFormInputText();
$this->widgetSchema['message'] = new sfWidgetFormTextarea();
/*
$this->setWidgets(array(
'firstname' => new sfWidgetFormInputText(),
'lastname' => new sfWidgetFormInputText(),
/* 'gender' => new sfWidgetFormChoice(),
/* 'date_of_birth'=> new sfWidgetFormI18nDate(),
'street' => new sfWidgetFormInputText(),
'zipcode' => new sfWidgetFormInputText(),
'city' => new sfWidgetFormInputText(),
'phone' => new sfWidgetFormInputText(),
'email' => new sfWidgetFormInput(),
'partner' => new sfWidgetFormInputText(),
'message' => new sfWidgetFormTextarea(),
));
*/
$w = new sfWidgetFormChoice(array(
'expanded' => true,
'multiple' => false,
'choices' => array('m' => 'Mann', 'w' => 'Frau')
));
$this->setValidator('gender' , new sfValidatorString(array('required' => true)));
$this->widgetSchema['gender'] = $w;
$w = new sfWidgetFormChoice(array(
'expanded' => true,
'multiple' => false,
'choices' => array('L' => 'Leader', 'F' => 'Follower')
));
$this->setValidator('role' , new sfValidatorString(array('required' => true)));
$this->widgetSchema['role'] = $w;
// do some additional styling
$years = range(date('Y'), date('Y')-100);
$this->widgetSchema['date_of_birth'] = new sfWidgetFormI18nDate(array(
'culture' => 'de',
'years' => array_combine($years, $years),
'can_be_empty' => true,
'empty_values' => array('day' => 'Tag', 'month' => 'Monat', 'year' => 'Jahr')
));
$this->widgetSchema->setLabel(
'date_of_birth',
'Geburtstag'
);
// VALIDATORS
$this->setValidator('firstname' , new sfValidatorString(array('required' => true)));
$this->setValidator('lastname' , new sfValidatorString(array('required' => true)));
$this->setValidator('email' , new sfValidatorEmail() );
$this->setValidator('street' , new sfValidatorString(array('required' => true)));
$this->setValidator('city' , new sfValidatorString(array('required' => true)));
$this->setValidator('zipcode', new sfValidatorString(array('min_length' => 4 )));
$this->setValidator('phone' , new sfValidatorString(array('min_length' => 10 )));
$this->setValidator('student', new sfValidatorBoolean() );
$this->setValidator('message' , new sfValidatorString( array('required' => false) ));
$this->setValidator('partner' , new sfValidatorString( array('required' => false) ));
$this->setValidator('date_of_birth' , new sfValidatorDate( array('required' => false) ));
//$this->setValidator('message' , new sfValidatorString( array('min_length' => 4) ));
/*
$this->setDefaults(array(
'email' => 'me@example.com'
));
*/
//.........这里部分代码省略.........