1770 Posts in 495 Topics by 531 members
Blog Module
SilverStripe Forums » Blog Module » Extending Blog Entries - Best Way?
Discuss the Blog Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 2645 Views |
-
Re: Extending Blog Entries - Best Way?

31 January 2010 at 10:25pm
Ok, I haven't tested it but something like this would be how you do it.
// add this to mysite/_config.php
DataObject::add_extension('BlogEntry', 'CustomBlogEntry');// put this code in mysite/code/CustomBlogEntry.php
<?phpclass CustomBlogEntry extends DataObjectDecorator {
public function updateCMSFields(FieldSet &$fields) {
$fields->removeFieldFromTab('Root','LeftSidebar'));
$fields->removeFieldFromTab('Root','RightSidebar'));
}
} -
Re: Extending Blog Entries - Best Way?

31 January 2010 at 10:35pm Last edited: 31 January 2010 10:39pm
Hi Willr,
I tried the exact same thing shortly after I posted. I've got just what you posted (minus the extra closing brackets on the two removefieldfromtab lines), and it's still not working. I am very confused now.
-
Re: Extending Blog Entries - Best Way?

31 January 2010 at 10:39pm
Perhaps try putting a die() statement in that function. Does it even get called?.
-
Re: Extending Blog Entries - Best Way?

31 January 2010 at 10:41pm Last edited: 31 January 2010 10:47pm
I tried that too, and the function is indeed being called.
Now, my tabs for "Left Sidebar" and "Right Sidebar" were actually created on the Page datatype, which BlogEntry extends. That shouldn't matter, should it?
-
Re: Extending Blog Entries - Best Way?

31 January 2010 at 10:47pm
Well the first thing is to work out why that decorator isn't being applied. I'm guessing you're done the usual admin/?flush=1 to flush the cache?
-
Re: Extending Blog Entries - Best Way?

31 January 2010 at 10:49pm Last edited: 31 January 2010 10:57pm
I've done a flush on both /admin/ and on /dev/build/
-
Re: Extending Blog Entries - Best Way?

5 February 2010 at 9:04pm
Thanks for you help with that Willr, I managed to get it working with Subclassing the blog module in the end. (Had quite lot of changes to make.)
| 2645 Views | ||
| Go to Top | Next > |


