746 Posts in 310 Topics by 289 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1199 Views |
-
more than a widget area

3 August 2010 at 12:58am Last edited: 3 August 2010 2:22am
hi!
I have two question about widget:1. I need to use two widget area (two widget tab in my admin cms). Is possible to do this operations? I found this link http://open.silverstripe.org/ticket/2131 in a post. I must copy in my Silverstripe code this correct file? I try but don't work..in my Page.php i write:
public static $has_one = array(
'Widget1'=>'WidgetArea',
'Widget2'=>'WidgetArea');
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("Widget1"));
$fields->addFieldToTab("Root.Content.Widgets2", new WidgetAreaEditor("Widget2"));
return $fields;
}2. Is possible choose what type of widget I can use in the first area and what in the second area? For example: I want widget A, B, C in area A and widget D,F in area B. My idea was to create two main folder in root (Widget_A and Widget_B) and insert here the widget that i download from site.
thanks!!
-
Re: more than a widget area

2 October 2010 at 4:18am
I'm wondering the same thing... I could make a new tab with widgets, but how to select which widgets to show there?
-
Re: more than a widget area

2 October 2010 at 4:42am Last edited: 2 October 2010 4:44am
Did you not try the suggestion at the start of this thread?
looks good to me and I'm interested in getting this working for future projects...
-
Re: more than a widget area

2 October 2010 at 4:46am
I did try it and the result is 2 tabs with all the widgets. I'm trying to group the widgets...
There is a similar topic http://ssorg.bigbird.silverstripe.com/widgets-2/show/261491
I'm trying to extend WidgetAreaEditor now. Hoping to do the job...
-
Re: more than a widget area

2 October 2010 at 4:52am
Ahhh I like that, that will be useful, it might be easier then to instead setup widget area sepearatly from pages (maybe in modelamdin, as a windgetareagroup dataobjectset) and then select multiple windgetareagroups for each page
-
Re: more than a widget area

5 October 2010 at 5:10am Last edited: 5 October 2010 9:43pm
Been having some success....
Made an additional tab "Banners" in the admin area which shows only two widgets: BannerLongWidget and BannerSquareWidget. And the other tab Widgets contains the other widgets without the banners ones. Two files extend WidgetAreaEditor to filter the showed and used banners in both tabs (in admin area) and to filter them again when saving data in the database. By filtering I mean grouping banners and the other widgets.
There are 2 problems so far I think:
1. When trying to delete a widget, I can only delete a widget from the tab Banners (which is placed before the Widgets one) and can't delete widgets from the other one. I don't understand quite well the JavaScript in SS...
2. The widgets from both tabs are still placed in the WidgetArea holder. Not quite sure how to move them to my custom area...Edit: The workaround I came up with is putting all widgets in the widget area as it's meant to be and moving some of them by custom JS where ever I need to. It is ugly as hell, but at least this way I could allow my client to put widgets (in my case banners) on areas other then the widget area... The custrom JS is inserted in BannerWidget.ss file or the widget that needs to be moved. Other drawback is that the custom JS may not work for all pages because the DOM differs from page to page... so that would require more custom JS.
| 1199 Views | ||
|
Page:
1
|
Go to Top |


