本文整理汇总了PHP中sfForm::configure方法的典型用法代码示例。如果您正苦于以下问题:PHP sfForm::configure方法的具体用法?PHP sfForm::configure怎么用?PHP sfForm::configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfForm
的用法示例。
在下文中一共展示了sfForm::configure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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]');
$this->widgetSchema->setFormFormatterName('bootstrap');
//Include captcha if enabled
if ($this->isCaptchaEnabled() )
{
$this->addCaptcha();
}
}
示例2: configure
public function configure()
{
parent::configure();
$this->getWidgetSchema()->setNameFormat('pagina[%s]');
/*unset(
$this['created_at'], $this['updated_at']//,$this["user_id"]
); */
//enabling rich editor with extraform
//$this->setWidget('content', new sfWidgetFormTextarea(array(), array('rows' => '40', 'cols' => '90', 'rich'=> 'true')));
$this->widgetSchema['url'] = new sfWidgetFormInputText(array('default' => $this->cmspageobj->getUrl()));
$this->setWidget('_csrf_token', new sfWidgetFormInputHidden(array('default' => '355868214ea56c1caf6c2f2c776aef19cd6917f5')));
$this->setWidget('idPage', new sfWidgetFormInputHidden(array('default' => $this->cmspageobj->getId())));
$this->setWidget('groupContentId', new sfWidgetFormInputHidden(array('default' => $this->cmspageobj->getCmsgroupcontentId())));
/*$this->widgetSchema['content'] = new sfWidgetFormTextarea(array('default'=>
($this->cmspageobj->getContent()!=null)?$this->cmspageobj->getContent()->getContent():"Insert html content here!")
);
*
*/
$this->setWidget('content', new sfWidgetFormTextareaTinyMCE(array('width' => 550, 'height' => 350, 'config' => 'theme_advanced_disable: "cleanup,help",
file_browser_callback:"sfAssetsLibrary.fileBrowserCallBack",
plugins : "safari,spellchecker,pagebreak,style,layer,table,advhr,advimage,advlist,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,wordcount",
theme_advanced_buttons5_add : "pastetext,pasteword,selectall",
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,restoredraft,|,insertfile,insertimage",
theme_advanced_buttons6_add : "media"')));
$this->validatorSchema['url'] = new sfValidatorString(array('required' => true, 'min_length' => 3, 'max_length' => 128));
$this->validatorSchema['content'] = new sfValidatorString(array('required' => true));
$this->validatorSchema['idPage'] = new sfValidatorInteger(array('required' => false));
$this->validatorSchema['groupContentId'] = new sfValidatorInteger(array('required' => false));
$this->validatorSchema->setPostValidator(new sfValidatorPropelUnique(array('model' => 'CMSPage', 'column' => 'url', 'primary_key' => 'id')));
}
示例3: configure
/**
* Configures the current form.
*
* @author Jérôme Pierre <contact@susokary.com>
* @version V1 - August 9th 2010
*
* @param n/a
*
* @return n/a
*
*/
public function configure()
{
parent::configure();
$this->setWidget('_file_path', new sfWidgetFormInputFile(array('label' => 'Demo image')));
$this->setValidator('_file_path', new sfValidatorFile(array('required' => true, 'mime_types' => array('image/jpeg', 'image/pjpeg', 'image/tiff'))));
$this->widgetSchema->setNameFormat('s6yExifDataManagerForm[%s]');
}
示例4: configure
public function configure()
{
parent::configure();
$this->setWidgets(array('nome' => new sfWidgetFormInput(), 'email' => new sfWidgetFormInput(), 'telefone' => new sfWidgetFormInput(), 'mensagem' => new sfWidgetFormTextarea()));
$this->widgetSchema->setLabels(array('nome' => 'Nome', 'email' => 'E-mail', 'telefone' => 'Telefone', 'mensagem' => 'Mensagem'));
$this->setValidators(array('nome' => new sfValidatorString(), 'email' => new sfValidatorEmail(), 'telefone' => new sfValidatorString(array('required' => false)), 'mensagem' => new sfValidatorString(array('min_length' => 4))));
$this->widgetSchema->setNameFormat('contact[%s]');
}
示例5: configure
public function configure()
{
parent::configure();
$this->setWidget('username', new sfWidgetFormInput(array(), array('maxlength' => 16)));
$this->setValidator('username', 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.")))));
$this->widgetSchema->setNameFormat('sfApplyResetRequest[%s]');
$this->widgetSchema->setFormFormatterName('list');
}
示例6: configure
public function configure()
{
parent::configure();
$this->setWidgets(array('nome' => new sfWidgetFormInput(), 'email' => new sfWidgetFormInput(), 'telefone' => new sfWidgetFormInput(), 'mensagem' => new sfWidgetFormTextarea(), 'captcha' => new sfAnotherWidgetFormReCaptcha()));
$this->widgetSchema->setLabels(array('nome' => 'Nome', 'email' => 'E-mail', 'telefone' => 'Telefone', 'mensagem' => 'Mensagem', 'captcha' => 'Digite as palavras abaixo'));
$this->setValidators(array('nome' => new sfValidatorString(), 'email' => new sfValidatorEmail(), 'telefone' => new sfValidatorString(array('required' => false)), 'mensagem' => new sfValidatorString(array('min_length' => 4))));
$this->widgetSchema->setNameFormat('contact[%s]');
$this->validatorSchema->setPostValidator(new sfAnotherValidatorSchemaReCaptcha($this, 'captcha'));
}
示例7: configure
public function configure()
{
parent::configure();
$this->setWidget('username', new sfWidgetFormInput(array(), array('maxlength' => 16)));
$this->widgetSchema->setLabels(array('username' => 'Логин:'));
$this->setValidator('username', 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" => "Пользователь с таким логином не существует."))), array(), array('required' => 'Необходимо ввести логин!')));
$this->widgetSchema->setNameFormat('sfApplyResetRequest[%s]');
$this->widgetSchema->setFormFormatterName('list');
}
示例8: configure
public function configure()
{
parent::configure();
$this->setWidgets(array('email' => new sfWidgetFormInput(), 'senha' => new sfWidgetFormInputPassword()));
$this->widgetSchema->setLabels(array('email' => 'E-mail'));
$this->validatorSchema['email'] = new sfValidatorString(array('required' => true), array('required' => 'Requirido'));
$this->validatorSchema['senha'] = new sfValidatorString(array('required' => true), array('required' => 'Requirido'));
$this->widgetSchema->setNameFormat('login[%s]');
}
示例9: configure
public function configure()
{
parent::configure();
$this->disableCSRFProtection();
$this->setWidget('file', new sfWidgetFormInputFile());
$this->setValidator('file', new sfValidatorFile(array('required' => true, 'path' => sfConfig::get('sf_upload_dir'), 'mime_types' => array('text/csv', 'text/plain', 'text/comma-separated-values', 'application/csv', 'application/excel', 'application/vnd.ms-excel', 'application/vnd.msexcel')), array('invalid' => 'Please select only a csv file for upload.', 'required' => 'Select a file to upload.', 'mime_types' => 'The file must be a csv file .')));
$this->getWidgetSchema()->setNameFormat('import[%s]');
$this->widgetSchema->setLabels(array('file' => 'Fichier'));
}
示例10: configure
public function configure()
{
parent::configure();
$this->setWidgets(array('product_id' => new sfWidgetFormInputHidden(), 'email_address_sender' => new sfWidgetFormInput(), 'email_address_recipient' => new sfWidgetFormInput(), 'message' => new sfWidgetFormTextarea()));
$this->setValidators(array('product_id' => new sfValidatorInteger(array('required' => true)), 'email_address_sender' => new sfValidatorEmail(array('max_length' => 255, 'required' => true)), 'email_address_recipient' => new sfValidatorEmail(array('max_length' => 255, 'required' => true)), 'message' => new sfValidatorString(array('max_length' => 255, 'required' => false))));
$this->widgetSchema['email_address_sender']->setLabel('Your Email');
$this->widgetSchema['email_address_recipient']->setLabel('Friends Email');
$this->widgetSchema->setNameFormat('rt_send_to_friend[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->getWidgetSchema()->setFormFormatterName(sfConfig::get('app_rt_public_form_formatter_name', 'RtList'));
}
示例11: configure
public function configure()
{
parent::configure();
$this->disableCSRFProtection();
$this->setWidget('rfid_groupe_id', new sfWidgetFormDoctrineChoice(array('model' => 'RfidGroupe', 'add_empty' => true)));
$this->setWidget('rfid_ids', new sfWidgetFormInputHidden());
$this->setValidator('rfid_ids', new sfValidatorPass(array('required' => true)));
$this->setValidator('rfid_groupe_id', new sfValidatorDoctrineChoice(array('required' => true, 'model' => 'RfidGroupe', 'column' => 'guid')));
$this->getWidgetSchema()->setNameFormat('assign[%s]');
$this->widgetSchema->setLabels(array('' => 'Groupe à assigner'));
}
示例12: configure
/**
* @see sfForm
*/
public function configure()
{
$this->widgetSchema['email_address'] = new sfWidgetFormInputEmail(array(), array('placeholder' => 'example@domain.com'));
$this->validatorSchema['email_address'] = new sfValidatorPass();
$this->widgetSchema->setNameFormat('forgot_password[%s]');
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();
}
示例13: configure
public function configure()
{
parent::configure();
$this->disableCSRFProtection();
//$this->setWidget('title', new sfWidgetFormInput());
//$this->setValidator('title', new sfValidatorString(array('required' => true)));
foreach ($this->getFields() as $fieldDecorator) {
$this->setWidget($fieldDecorator, new sfWidgetFormInputCheckbox());
$this->setValidator($fieldDecorator, new sfValidatorBoolean());
$this->setDefault($fieldDecorator, true);
}
$this->getWidgetSchema()->setNameFormat('export[%s]');
$this->setDefault('title', $this->getOption('title'));
$this->setDefault('type', $this->getOption('type'));
}
示例14: configure
public function configure()
{
parent::configure();
$this->setWidgets(array('username' => new sfWidgetFormInput(), 'password' => new sfWidgetFormInputPassword(), 'confirmpassword' => new sfWidgetFormInputPassword(), 'firstname' => new sfWidgetFormInput(), 'lastname' => new sfWidgetFormInput(), 'email' => new sfWidgetFormInput()));
$this->widgetSchema->setLabel('username', 'UserName');
$this->widgetSchema->setLabel('password', 'Password');
$this->widgetSchema->setLabel('confirmpassword', 'Confirm Password');
$this->widgetSchema->setLabel('firstname', 'First Name');
$this->widgetSchema->setLabel('lastname', 'Last Name');
$this->widgetSchema->setLabel('email', 'Email');
$this->setValidators(array('username' => new sfValidatorString(array('required' => true)), 'password' => new sfValidatorString(array('required' => true)), 'confirmpassword' => new sfValidatorString(array('required' => true)), 'firstname' => new sfValidatorString(array('required' => true)), 'lastname' => new sfValidatorString(array('required' => true)), 'email' => new sfValidatorEmail()));
$this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'confirmpassword', array(), array('invalid' => 'The two passwords must be the same.')));
$this->widgetSchema->setNameFormat('newuser[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
parent::setup();
}
示例15: configure
public function configure()
{
parent::configure();
$this->widgetSchema->setNameFormat('multiple_student_attendance[%s]');
$this->validatorSchema->setOption('allow_extra_fields', true);
$this->setWidget('year', new sfWidgetFormInputHidden());
$this->setValidator('year', new sfValidatorPass());
$this->setWidget('day', new sfWidgetFormInputHidden());
$this->setValidator('day', new sfValidatorPass());
$this->setWidget('career_school_year_id', new sfWidgetFormInputHidden());
$this->setValidator('career_school_year_id', new sfValidatorPass());
$this->setWidget('course_subject_id', new sfWidgetFormInputHidden());
$this->setValidator('course_subject_id', new sfValidatorPass());
$this->setWidget('division_id', new sfWidgetFormInputHidden());
$this->setValidator('division_id', new sfValidatorPass());
$this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'validarPeriodo'))));
}