public function configure() { parent::configure(); unset($this['updated_at']); if (isset($this['id'])) { unset($this['id']); } $widget = $this->getObject(); $petition = $widget->getPetition(); $this->setWidget('edit_code', new sfWidgetFormInputHidden()); $this->setValidator('edit_code', new sfValidatorString(array('required' => false))); $this->setWidget('petition_text_id', new WidgetPetitionText(array('petition_id' => $widget->getPetitionId(), 'petition_text_id' => $widget->getPetitionTextId()))); $this->setValidator('petition_text_id', new ValidatorPetitionText(array('petition_id' => $widget->getPetitionId(), 'petition_text_id' => $widget->getPetitionTextId(), 'required' => false))); $this->getWidgetSchema()->setLabel('petition_text_id', false); if ($widget->isNew()) { $this->setWidget('email', new sfWidgetFormInput()); $this->setValidator('email', new ValidatorEmail()); $this->getWidgetSchema()->setLabel('email', 'Email address'); $this->setWidget('organisation', new sfWidgetFormInput()); $this->setValidator('organisation', new sfValidatorString()); } if (isset($this['title'])) { $this->setWidget('title', new sfWidgetFormInputHidden(array(), array('class' => 'original'))); } if (isset($this['target'])) { $this->setWidget('target', new sfWidgetFormTextarea(array('is_hidden' => true), array('class' => 'original not_required'))); } if (isset($this['background'])) { $this->setWidget('background', new sfWidgetFormTextarea(array('is_hidden' => true), array('class' => 'original'))); } if (isset($this['intro'])) { $this->setWidget('intro', new sfWidgetFormTextarea(array('is_hidden' => true), array('class' => 'original'))); } if (isset($this['footer'])) { $this->setWidget('footer', new sfWidgetFormTextarea(array('is_hidden' => true), array('class' => 'original'))); } if (isset($this['email_subject'])) { $this->setWidget('email_subject', new sfWidgetFormInputHidden(array(), array('class' => 'original'))); } if (isset($this['email_body'])) { $this->setWidget('email_body', new sfWidgetFormTextarea(array('is_hidden' => true), array('class' => 'original'))); } $this->setWidget('ref', new sfWidgetFormInputHidden(array(), array('class' => 'ref'))); $this->setValidator('ref', new sfValidatorString(array('required' => false))); if ($petition->getWidgetIndividualiseText() || $petition->getWidgetIndividualiseDesign()) { $this->setWidget('landing_url', new sfWidgetFormInputHidden(array(), array('class' => 'original not_required'))); } else { $this->setWidget('landing_url', new sfWidgetFormInputText(array('label' => 'Email Validation Landingpage - auto forwarding to external page', 'default' => $widget->getInheritLandingUrl()), array('class' => 'url not_required', 'placeholder' => 'http://example.com/'))); $this->one_side = true; } $this->setValidator('landing_url', new ValidatorUrl(array('required' => false, 'trim' => true))); $this->widgetSchema->setFormFormatterName('policatWidget'); }