コード例 #1
0
 public function configure()
 {
     $this->setWidget('captcha', new opWidgetFormCaptcha());
     $this->setValidator('captcha', new sfValidatorPass());
     $formatter = new sfWidgetFormSchemaFormatterList($this->widgetSchema);
     $formatter->setRowFormat("<li>%field%%help%\n%hidden_fields%</li>\n");
     $formatter->setHelpFormat('<div class="help">%help%</div>');
     $this->widgetSchema->addFormFormatter('opCaptchaFormFormatter', $formatter);
     $this->widgetSchema->setFormFormatterName('opCaptchaFormFormatter');
     $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'validateCaptchaString'))));
     $this->widgetSchema->setHelp('captcha', 'Please input the below keyword.');
 }