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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

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


Go to End


2 Posts   1492 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" .