Jump to:

746 Posts in 310 Topics by 289 members

Widgets

SilverStripe Forums » Widgets » Multiple Widget Areas. What problem?

Discuss SilverStripe Widgets.

Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 542 Views
  • tazzydemon
    Avatar
    Community Member
    88 Posts

    Multiple Widget Areas. What problem? Link to this post

    I have seen many people ask if you can have more than one widget area and many more reply that you can't.

    I just tried it and you can.. its as easy as this in page.php...

    static $has_one = array(
       "Sidebar1" => "WidgetArea",
    "Sidebar2" => "WidgetArea",
    "Sidebar3" => "WidgetArea"
    );

    function getCMSFields() {
       $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("Sidebar1"));
    $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("Sidebar2"));
    $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("Sidebar3"));

    And then just splatter the $Sidebar1 $Sidebar2 $Sidebar3 wherever you want.

    I just have to figure out how to make a pageholder page so I can start with one set of widgets for all pages.

  • Juan
    Avatar
    Community Member
    18 Posts

    Re: Multiple Widget Areas. What problem? Link to this post

    Hello Tazzy

    what version of silvestripe did you use on this?

    i've try it on 2.4 but it doesnt work.

    542 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.