Jump to:

794 Posts in 408 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » Installing widgets in ver 3.0.3

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 842 Views
  • albere
    Avatar
    Community Member
    6 Posts

    Installing widgets in ver 3.0.3 Link to this post

    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.

  • Matty Balaam
    Avatar
    Community Member
    69 Posts

    Re: Installing widgets in ver 3.0.3 Link to this post

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

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