Hello, I'm trying to extend BlogModule, but it doesn't work.
What I've done thus far:
BlogEntryDecorator:
<?php
class BlogEntryDecorator extends SiteTreeDecorator {
function extraStatics() {
return array(
'static $db' => array(
"Source" => "Text",
"SourceURL" => "Text"
),
'has_one' => array(
'Photo' => 'Image'
)
);
}
function updateCMSFields(& $fields){
$fields->addFieldToTab("Root.Content.Main", new TextField("Source"));
$fields->addFieldToTab("Root.Content.Main", new TextField("SourceURL));
$fields->addFieldToTab("Root.Content.Image", new SimpleImageField('Photo','An image for this Blog Entry'));
}
}
added DataObject::add_extension('BlogEntry', 'BlogEntryDecorator'); to _config.php
BlogSummary.ss:
<div class="blogSummary">
...
...
<% if BlogEntryImage %>
<% control BlogEntryImage %>$CroppedImage(79,89) <% end_control %>
<% end_if %>
$Photo
$ParagraphSummary
<a href="$SourceURL">$Source</a>
...
...
</div>
When creating new form I get SimpleImageField for entering photo and 2 fields to enter source and sourceurl.
When going to /admin I see the image properly uploaded, but source and sourceurl fields are empty
Nothing shows on site
Please Help!