Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Widgets will not add to pages

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

Page: 1
Go to End
Author Topic: 674 Views
  • eth0
    Community Member
    1 Post

    Widgets will not add to pages Link to this post

    Hi all, I'm just playing around with Silverstripe and I've created a new widget.

    I've created a folder in the root directory of Silverstripe called widgets_chatbox which contains three files; ChatBoxWidget.php ChatBoxWiget.ss and _config.php

    My ChatBoxWidget.php is as follows:

    class ChatBoxWidget extends Widget {
    static $title = "Chat Box";
    static $cmsTitle = "Chat Box";
    static $description = "Shows a chat box";

    static $db = array("Type" => "Varchar");
    static $defaults = array("Type" => "sales");

    function getCMSFields() {
    // TODO: Use TreeDropdownField when it's fixed
    return new FieldSet(
    new DropdownField("Type", "Select ChatBox Type", array("sales", "support"))

    function RenderChatBox() {
    return 'hello';

    So, as you can see it is extremely simple and doesn't do an awful lot.

    my _config.php is blank (includes <?php ?> tags)

    After running dev/build and ?flush=1 the Widget correctly shows up in the Widget tab of a page and I can add it and select my options ,etc. However when I Save the page it instantly removes it self, no errors or anything so I'm really confused. Has anybody got any ideas?

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.