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.

Widgets /

Discuss SilverStripe Widgets.

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

Getting Widgets in SS Admin to work on other pages


Go to End


4 Posts   2108 Views

Avatar
growin

Community Member, 41 Posts

6 March 2011 at 3:53pm

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.

Avatar
swaiba

Forum Moderator, 1899 Posts

6 March 2011 at 10:52pm

Hi,

Read this... http://doc.silverstripe.org/sapphire/en/topics/widgets#adding-widgets-to-other-pages
You will find everything you need there.

Avatar
growin

Community Member, 41 Posts

7 March 2011 at 5:43am

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?

Avatar
swaiba

Forum Moderator, 1899 Posts

7 March 2011 at 9:01am

Edited: 07/03/2011 9:03am

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?