Jump to:

22999 Posts in 11854 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » ModelAdmin - Adding new tabs in right panel

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

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

Page: 1
Go to End
Author Topic: 2627 Views
  • Sec
    Avatar
    Community Member
    13 Posts

    ModelAdmin - Adding new tabs in right panel Link to this post

    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!

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: ModelAdmin - Adding new tabs in right panel Link to this post

    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

  • joelg
    Avatar
    Community Member
    129 Posts

    Re: ModelAdmin - Adding new tabs in right panel Link to this post

    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;
       }

  • BenWu
    Avatar
    Community Member
    87 Posts

    Re: ModelAdmin - Adding new tabs in right panel Link to this post

    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

    2627 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.