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

Installing widgets in ver 3.0.3


Go to End


2 Posts   2377 Views

Avatar
albere

Community Member, 6 Posts

4 January 2013 at 4:36am

I've not used widgets in Silverstripe before. I've updated the site to the latest release 3.0.3 and attempted to install a widget following the various hints on this site. I have done /dev/build/?flush=1. There are two tables in the database "Widgets" and WidgetsArea". Both appear correctly setup but have no entries. Admin does not show the widget tab. The error I'm getting on the public site is:

"[User Error] DataObject::buildSQL: Can't find data classes (classes linked to tables) for WidgetArea. "

The widget I'm trying to use is in the following folder which I created:
http://mydomain.com/widgets/facebook_like_box

My /mysite/code/Page.php file looks like this:

<?php
class Page extends SiteTree {

public static $db = array(
);

public static $has_one = array(
"facebook_like_box" => "WidgetArea",
);

}
class Page_Controller extends ContentController {

/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);

public function init() {
parent::init();

// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
Requirements::themedCSS('layout');
Requirements::themedCSS('typography');
Requirements::themedCSS('form');
}

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

}

Any ideas much appreciated.

Thanks.

Avatar
Matty Balaam

Community Member, 74 Posts

15 January 2013 at 11:31am

Silverstripe 3 requires you to install the Widgets module, have you done that?