Good day all
I am trying to add a second upload field to my blog module but am having trouble doing so...
The main issue i am currently having is that the FeaturedThumbnail does not show in my cms
what i have tried was:
#1
private static $has_one = array(
'FeaturedImage' => 'Image',
'FeaturedThumbnail' => 'Image',
);
public function getCMSFields(){
Requirements::css(BLOGGER_DIR . '/css/cms.css');
Requirements::javascript(BLOGGER_DIR . '/js/cms.js');
$self =& $this;
$this->beforeUpdateCMSFields(function ($fields) use ($self) {
$uploadField = UploadField::create('FeaturedThumbnail', _t('BlogPost.FeaturedThumbnail', 'Featured Thumbnail'));
$uploadField = UploadField::create('FeaturedImage', _t('BlogPost.FeaturedImage', 'Featured Image'));
$fields->insertAfter($summaryHolder, 'FeaturedImage');
$fields->insertAfter($summaryHolder, 'FeaturedThumbnail');
return $fields;
}
#2
// Create a new file in extensions
<?php
class BlogEntryDecorator extends DataExtension {
static $has_one = array(
'FeaturedThumbnail' => 'Image'
);
public function updateCMSFields(FieldList $fields) {
parent::updateCMSFields($fields);
$fields->addFieldToTab("Root.Main", $FeaturedThumbnail = new UploadField('FeaturedThumbnail'), 'Content');
}
}
// Create add extension in _config
DataObject::add_extension('BlogEntry', 'BlogEntryDecorator');
If anyone can assist in this problem it would be greatly appreciated
Thanks
Skullie