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.

Customising the CMS /

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

Widgets will not add to pages

Go to End



Community Member, 1 Post

14 May 2010 at 4:03am

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 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?