public function configure() { parent::configure(); unset($this['password'], $this['id'], $this->widgetSchema['twitter_id'], $this->widgetSchema['avatar'], $this['admin']); $user = $this->getUser(); $this->setDefaults(array('username' => $user->getAttribute('screen_name', '', 'twitter'), 'fullname' => $user->getAttribute('name', '', 'twitter'), 'location' => $user->getAttribute('location', '', 'twitter'), 'homepageurl' => $user->getAttribute('url', '', 'twitter'), 'about' => $user->getAttribute('bio', '', 'twitter'))); $this->widgetSchema->setNameFormat('twitterDetails[%s]'); $this->validatorSchema['username']->setOption('required', true); }
public function configure() { parent::configure(); unset($this['id'], $this['avatar']); $this->widgetSchema['phone'] = new sfWidgetFormInput(); $this->validatorSchema['phone'] = new sfValidatorCallback(array('callback' => array($this, 'doValidate'), 'required' => true)); $this->widgetSchema['password'] = new sfWidgetFormInputPassword(); $this->validatorSchema['password'] = new sfValidatorString(array('min_length' => 5)); $this->widgetSchema->setNameFormat('signup[%s]'); }
public function configure() { parent::configure(); unset($this->widgetSchema['id'], $this['admin'], $this['username'], $this['password']); // only allow password change for non-twitter users (ie: those that already have a password) if (sfContext::getInstance()->getUser()->getPassword()) { $this->widgetSchema['password_change'] = new sfWidgetFormInputPassword(); $this->validatorSchema['password_change'] = new sfValidatorString(array('min_length' => 5, 'required' => false)); } else { // dont allow twitter_id changing for twitter users unset($this['twitter_id']); } $this->widgetSchema->setNameFormat('settings[%s]'); }