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.

Archive /

Our old forums are still available as a read-only archive.

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

Adding a custom tab into CMS


Go to End


6 Posts   2626 Views

Avatar
F4LLEN

Community Member, 4 Posts

12 March 2008 at 10:46am

Edited: 12/03/2008 10:47am

I sware this should be easier than it looks, i simply cannot find how to do this? ive looked through the forums, all the documentation, please tell me im blind.

How do you add a custom tab into the CMS with a content area the same as the first tab?

Cheers

Avatar
saimo

Community Member, 67 Posts

12 March 2008 at 11:01am

Have a look at tutorial 2: Extending a basic site: http://doc.silverstripe.com/doku.php?id=tutorial:2-extending-a-basic-site

Avatar
F4LLEN

Community Member, 4 Posts

12 March 2008 at 11:25am

Edited: 12/03/2008 12:33pm

For some reason, this isnt creating the tab 'RightCol'. Ive read the tutorial 3 times.

class HomePage extends Page {
    static $db = array(
        'SideText' => 'HTMLText'
    );
}

class HomePage_Controller extends Page_Controller {
    function getCMSFields() {
        $fields = parent::getCMSFields();	
        $fields->addFieldToTab('Root.Content.RightCol', new TextField('SideText'));		
        return $fields;
    }
}

Avatar
F4LLEN

Community Member, 4 Posts

12 March 2008 at 5:15pm

can anyone tell me why this isnt working?

Avatar
spenniec

Community Member, 37 Posts

12 March 2008 at 8:53pm

Hi
You have specified the data-type of db field SideText as HTMLText but then declared a new form-field of the type TextField. This should really be of the type HTMLEditorField if you want the form to display HTML.
That might be why the tab isn't being rendered...

Avatar
F4LLEN

Community Member, 4 Posts

14 March 2008 at 11:31am

Thanks for all the help guys, i simply had the getCMSFields function under the wrong class.