Jump to:

794 Posts in 409 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » Getting Widgets in SS Admin to work on other pages

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 922 Views
  • growin
    Avatar
    Community Member
    41 Posts

    Getting Widgets in SS Admin to work on other pages Link to this post

    I've followed the instructions for adding widgets to other pages but unable to have it show in the Widgets tab as it show in the Blog. Any suggestions to make it active on all other pages, current and future? I'd like to have drag & drop the same way it is on the blog.

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts
  • growin
    Avatar
    Community Member
    41 Posts

    Re: Getting Widgets in SS Admin to work on other pages Link to this post

    I've read and done the instructions on that page. Widgets shows as a tab in the SS CMS Admin page for the blog page but not on any other page. How do I get it to show as a tab along with "Main", "Metadata" and "Google Sitemap" in the same drop & drag format as the blog page edit?

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: Getting Widgets in SS Admin to work on other pages Link to this post

    sounds like you have missed one of these bits...


    First step is to add an WidgetArea to the Database to store the widget details. Then you have to edit the CMS to add a Widget Form to manage the widgets. An example of this is below

    ** mysite/code/Page.php **

    class Page extends SiteTree {

    ...
    static $has_one = array(
    "Sidebar" => "WidgetArea",
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("Sidebar"));
    return $fields;
    }
    ....
    }

    or

    Then in your Template you need to call $SideBar whereever you want to render the widget

    Eg for blackcandy I put this above the closing </div>

    ** themes/myThemeName/templates/Includes/Sidebar.ss **

    $Sidebar

    or

    you needed to do a dev/build?

    922 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.