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.