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.

Customising the CMS /

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

Adding a new tab to Content


Go to End


3 Posts   5004 Views

Avatar
AJ_Trojan

Community Member, 3 Posts

12 June 2009 at 5:44am

Hi guys,

I want a new tab in the Content tab right next to the metadata tab...
for example Main ||Metadata || Job Listing

I'm new to silverstripe and i tried the following code from the tutorial...but its not working

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new Tab('JobListings'), 'Content');
return $fields;
}

Can anybody help me around ?

Avatar
sphire

Community Member, 6 Posts

13 June 2009 at 1:27am

This should do the trick.

$fields->addFieldToTab('Root.Content.JobListings', new TextField('Foo'));

You might also have a look at the API Docs to see what the parameters do here.
http://api.silverstripe.com/forms/fields-structural/FieldSet.html#addFieldToTab

Avatar
AJ_Trojan

Community Member, 3 Posts

17 June 2009 at 8:59am

That works . Thanks a lot :)