Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Widgets , Time to take them to the next level ? SS3


Reply


2 Posts   416 Views

Avatar
DesignerX.com.au

Community Member, 107 Posts

13 January 2013 at 8:00pm

Hi, I been playing around with widgets & I feel there is alot can be done & docs doesn't have alot of info about them. I will use this topic to ask questions & make it easier for others to find this info too :

class HomePage extends Page{

static $db = array(

);
static $has_one = array(
''MyWidgetArea' => 'WidgetArea'
);
}
1- How can I limit the number of widgets in 'MyWidgets'?
2- How can I make a widget unique per page , so a widget can be used only once in 'MyWidgets' ?

Thanks

Avatar
DesignerX.com.au

Community Member, 107 Posts

1 February 2013 at 9:28am

Hi, here is some code I been working on : http://www.sspaste.com/paste/show/51035a801337e
This adds a ParentID and ParentClassName to WidgetArea when they are related to Page(or its subclasses ) . I needed this when I wanted MyWidget to know its "Owner Page" .