コード例 #1
0
 public function setup()
 {
     parent::setup();
     sfProjectConfiguration::getActive()->loadHelpers(array('I18N'));
     $this->required = __('Required', array(), 'vjComment');
     $this->invalid_mail = __('Invalid Mail', array(), 'vjComment');
     $this->invalid_url = __('Invalid Url', array(), 'vjComment');
     $this->required_msg = __('Required message', array(), 'vjComment');
     $this->widgetSchema['record_model'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['record_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['reply'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['reply_author'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['user_name'] = new sfWidgetFormInputHidden();
     $this->validatorSchema['reply'] = new sfValidatorPass();
     $this->validatorSchema['reply_author'] = new sfValidatorPass();
     $this->validatorSchema['user_name'] = new sfValidatorPass();
     $this->widgetSchema->setLabel('author_name', __('Name', array(), 'vjComment'));
     $this->widgetSchema->setLabel('author_email', 'Email');
     $this->widgetSchema->setLabel('author_website', __('Website', array(), 'vjComment'));
     $this->widgetSchema->setLabel('body', 'Message');
     $this->widgetSchema->setHelp('author_website', __('Must start with http:// or https://', array(), 'vjComment'));
     $this->validatorSchema['author_email'] = new sfValidatorEmail();
     $this->validatorSchema['author_website'] = new sfValidatorUrl();
     $this->validatorSchema['author_name']->setMessage('required', $this->required);
     $this->validatorSchema['author_email']->setMessage('required', $this->required)->setMessage('invalid', $this->invalid_mail);
     $this->validatorSchema['author_website']->setOption('required', false)->setMessage('invalid', $this->invalid_url);
     $this->validatorSchema['body']->setOption('required', true)->setMessage('required', $this->required_msg);
 }
コード例 #2
0
 public function configure()
 {
     parent::setup();
     unset($this['created_at'], $this['updated_at'], $this['created_by'], $this['updated_by']);
 }