753 Posts in 312 Topics by 289 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1252 Views |
-
New Blog 4 module issues - Widgets on all pages

6 August 2010 at 9:53am
Hello,
I'm trying to add widgets to all of my pages. I also have the blog installed.
The double widget issue was occurring and I tried to follow the example here:http://doc.silverstripe.org/widgets?s=widgets.
However the code is different in the new blog release for (BlogHolder class). The $has_one is in the sitetree.php page instead of blogholder.I'm not sure how to stop the doubling widgets (in the admin) without breaking the blog.
-
Re: New Blog 4 module issues - Widgets on all pages

10 August 2010 at 4:14pm Last edited: 10 August 2010 4:14pm
Hi Tris,
I just had the same problem with Silverstripe 2.4.1.
Same as you I followed the steps at http://doc.silverstripe.org/widgets#adding_widgets_to_other_pages to enable Widgets on all pages which works fine, but I also ended up with a doubled-up widgets area editor on blog holder pages in the CMS.
Here is a workaround. Maybe it's not the ideal way but it seems to work. In /mysite/page.php in the Page class where you defined the WidgetAreaEditor for the interface (as described in the link above) simply make sure that Silverstripe does not do this for the BlogHolder page type because this causes the double WidgetAreaEditor. Here is the if statement I added (in green):
if($this->ClassName != 'BlogHolder') {
$fields->addFieldToTab('Root.Content.Widgets', new WidgetAreaEditor('Sidebar'));
}In versions prior to 2.4 I could simply remove the WidgetAreaEditor from BlogHolder.php but that doesn't seem to work properly any more since the WidgetAreaEditor was moved to BlogTree.php .
I hope that helps.
Cheers!
Anatol -
Re: New Blog 4 module issues - Widgets on all pages

11 August 2010 at 9:20am
Ah, what a simple solution.
It does help! Thank you Anatol!
| 1252 Views | ||
|
Page:
1
|
Go to Top |

