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 /

Adding a new tab to Content


Reply


3 Posts   2293 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 :)