Hello,
i need some help for a problem i can't solve. I'm banging my head on the table allready and this hurts my head and my ego ;)
I tried to create a simple DropdownField feeded from an Enum as a DataExtension.
class ProjectImage extends DataExtension {
static $db = array(
"ImageSizeInGrid" => "Enum('Fullsize, Onecolumn, Twocolumns', 'Fullsize')"
);
public function sizeInGrid() {
$fields = $this->owner->getCMSFields();
$newField = new DropdownField('ImageSizeInGrid', 'ImageSizeInGrid', $this->owner->dbObject('ImageSizeInGrid')->enumValues());
$fields->addFieldToTab('Root.Main', $newField);
return $fields;
}
}
i registered the DataExtension in my _config file:
Object::add_extension('File', 'ProjectImage');
and in my ProjectPage i have something like this:
public static $many_many = array(
'Images' => 'Image'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$imageField = new UploadField('Images', 'Portfolio images');
$imageField->setConfig('fileEditFields', 'sizeInGrid');
$fields->addFieldToTab('Root.Images', $imageField);
}
I flushed backend and frontend several times after i /dev/build the site. In the Database the table "File" has the custom created Enum Field with the right default value, but i can't get the dropdown to show up in the edit form. I then tried it with a simple text field, but it did not work either. As far as i can see, there are no error messages at all and the UploadField is working as it should, but without he custom field.
Can someone point me in the right direction, how i can create some custom fields for the UploadField?
Thank you very much and kind regards