public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     if ($value && is_string($value)) {
         $value = PetitionText::getHashForId($value);
     }
     return parent::render($name, $value, $attributes, $errors);
 }
 public function getChoices()
 {
     $petition_texts = Doctrine_Core::getTable('PetitionText')->createQuery('pt')->leftJoin('pt.Language l')->where('pt.petition_id = ?', $this->getOption('petition_id'))->andWhere('pt.status = ? or pt.id = ?', array(PetitionText::STATUS_ACTIVE, $this->getOption('petition_text_id')))->select('pt.id, l.id, l.name')->orderBy('l.order_number')->fetchArray();
     $language_choices = array();
     foreach ($petition_texts as $petition_text) {
         $language_choices[PetitionText::getHashForId($petition_text['id'])] = $petition_text['Language']['name'];
     }
     return $language_choices;
 }