public function setup() { $this->memberApplication = $this->getOption('member_application', null); if (!$this->memberApplication) { throw new LogicException(); } $this->setWidgets(array('public_flag' => new sfWidgetFormChoice(array('choices' => array_map(array(sfContext::getInstance()->getI18n(), '__'), self::$publicFlagChoices))))); $this->setValidators(array('public_flag' => new sfValidatorChoice(array('choices' => array_keys(self::$publicFlagChoices))))); if (opOpenSocialToolKit::isEnableHomeGadget()) { $this->setWidget('is_view_home', new sfWidgetFormInputCheckbox()); $this->setValidator('is_view_home', new sfValidatorBoolean()); $this->widgetSchema->setLabel('is_view_home', 'Display on the home'); } if (opOpenSocialToolKit::isEnableProfileGadget()) { $this->setWidget('is_view_profile', new sfWidgetFormInputCheckbox()); $this->setValidator('is_view_profile', new sfValidatorBoolean()); $this->widgetSchema->setLabel('is_view_profile', 'Display on your profile'); } foreach ($this->memberApplication->getApplicationSettings() as $name => $value) { if (!empty($value)) { $this->setDefault($name, $value); } } $this->setDefault('public_flag', $this->memberApplication->getPublicFlag()); $this->widgetSchema->setNameFormat('setting[%s]'); }