Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

[polls] SS 2.4 PollChoices DataObjectDecorator

Go to End



Community Member, 5 Posts

27 September 2012 at 11:23pm


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:


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'));


// 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?