Jump to:

23373 Posts in 18175 Topics by 2865 members

General Questions

SilverStripe Forums » General Questions » Sorting tabs

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: 1526 Views
  • mco
    Avatar
    Community Member
    14 Posts

    Sorting tabs Link to this post

    Hi,

    I need to add a new tab to a Page (Main, Behavior, Todo, ...) but I don't want to add it to the end but insert it between "Main" and "Behavior".
    Is there a insertFieldToTab instead of addFieldToTab or something else to custom re-sort the tab list?

    Thanks in advance,
    CM

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Sorting tabs Link to this post

    Hmm off the top of my head and a quick look I can't see anything. In 2.4 I can see a changeFieldOrder() function on FieldSet which may be what your looking for.

    Not completely sure if these will work but I think they may $fields->insertAfter(), $fields->insertBefore(). The tabs in the CMS are standard form fields so you might be able to move them round using those.

    If you have any luck would like to hear what worked.

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Sorting tabs Link to this post

    Have tried various options but suggestions don't seem to be working (unfortunately).

  • peterk
    Avatar
    Community Member
    3 Posts

    Re: Sorting tabs Link to this post

    Hey,

    it's as easy as one would guess - but i've searched for it like hours. Here is the solution:

    First create a new Tab:

    $fields->addFieldToTab("Root.Content", new Tab("Images"), "Metadata");

    and then add whatever you want to your Tab:

    $fields->addFieldToTab("Root.Content.Images", new Textfield("Test));

    Hope it helps,

    W

  • MonkeyBen
    Avatar
    Community Member
    25 Posts

    Re: Sorting tabs Link to this post

    That works, thank you peterk

    1526 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.