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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

ModelAdmin - Adding new tabs in right panel


Go to End


4 Posts   5869 Views

Avatar
Sec

Community Member, 13 Posts

16 June 2009 at 8:26pm

Trying to figure out ModelAdmin. Documentation is poor, so I hope someone else can share their experience with the ModelAdmin module.

I have set up a standard Aritcle - Category relation (basically the same as in the docs). When creating a new article, I get the article fields in a Main-tab in the right column panel. How do I add tabs to the new item action? E.g. I want a Image tab where I can set up various image uploads. Anyone have any experience with this?

I would also appreciate tips to where I can find docs on how to expand the module.

Thanks!

Avatar
Willr

Forum Moderator, 5523 Posts

17 June 2009 at 8:06pm

It automatically scaffolds the form fields. if you want to display it tabbed rather then the default I think you need to add a getCMSFields() function to your dataobject article and build up the interface the same way you do with CMSFields for pages - http://doc.silverstripe.com/doku.php?id=getcmsfields you would also need to create the tabs as well (since none exist) - http://doc.silverstripe.com/doku.php?id=tabset

Avatar
joelg

Community Member, 134 Posts

9 February 2010 at 4:10am

Hi Willr

I was just looking for this and as usual everything is über simple with SilverStripe. This code makes a new tab - without creating any new tabset:

function getCMSFields() {
		
		$fields = parent::getCMSFields();
	 	$fields->addFieldToTab('Root.Main', new ImageField("Picture", "Upload avatar."));
		return $fields;
	} 

Avatar
BenWu

Community Member, 97 Posts

18 May 2012 at 11:51pm

When i want to put the image field to another tab, i just do

$fields->addFieldToTab('Root.Images', new ImageField("Picture", "Upload avatar."));

and SS will remove the picture field from the Main and put it in the Images tab