Hi,
I'm using SilverStripe 2.4 and the latest polls module to create and manage a simple multiple choice poll on my site. What I'm trying to do, is to extend the poll choices to have couple extra fields such as an image per choice. Pretty simple stuff, just can't figure out how to get the fields to show up in admin. Here's what I have so far:
PollChoiceDecorator.php
class PollChoiceDecorator extends DataObjectDecorator {
function extraStatics() {
return array(
'db' => array(
'URL' => 'Varchar',
),
'has_one' => array(
'Image' => 'Image',
),
);
}
public function getCMSFields() {
$this->extend('updateCMSFields', $fields);
return $fields;
}
public function updateCMSFields(FieldSet $fields) {
$fields->push(new TextField('URL', 'URL address'));
$fields->push(new FileIFrameField('Image', 'Choice image'));
}
}
_config.php
// Extend PollChoice
Object::add_extension('PollChoice', 'PollChoiceDecorator');
The fields show up in db, but I can't get them to show up in the popup for a single choice. What am I doing wrong here? Is this even the right way to do this?