Jump to:

5516 Posts in 1734 Topics by 1221 members

Customising the CMS

SilverStripe Forums » Customising the CMS » new tab on tab in system

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

Page: 1 2 3 4
Go to End
Author Topic: 6604 Views
  • theAlien
    Avatar
    Community Member
    131 Posts

    new tab on tab in system Link to this post

    Hi all,

    I'm trying to make a new tabset on the maintab in the system, so that I can add fields to this new Root.Content.Main.Newtab-tab.
    Right now I have this:

    public static $db = array('Newtab' => 'TabSet');


    function getCMSFields() {
    $fields = parent::getCMSFields();

    $fields->addFieldToTab('Root.Content.Main', new Tab('Newtab','Newtab',array('Tab one','Tab two',));

    return $fields; }

    But that doesn't work. Does someone have a suggestion?

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: new tab on tab in system Link to this post

    Um, I don't think you can add a third level of tabs.....although I've never tried.

    Is there a particular reason you cant just add it to the end of the second level of tabs?

  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: new tab on tab in system Link to this post

    Hi,
    Thanks for your reply. Of course I can add it to the end of the other tabs.
    But I guess my users would more likely look top-down instead of left-right.
    Left-right seems to be for the more advanced features (f.e. metadata - most of my users don't even know what these are, but I don't want to remove them completely).
    Top-down would in that case be for the regular user.

    By adding tabs on the main tab, I can force them to not overlook some fields (that are essential, but too much to add in a normal way in the main-tab)

    Wow... that's quite a story. I hope you "can make chocolate out of it" (a weird dutch expression ;-) )

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: new tab on tab in system Link to this post

    hmm, I see. Well unfortunately i don't think I can help you as I've never seen this done.

    perhaps one of the more experienced devs knows if it's possible?

  • UncleCheese
    Avatar
    4085 Posts

    Re: new tab on tab in system Link to this post

    I'm having a really hard time understanding what you're trying to do. Instad of this:

    Content Behaviour ToDo
    ....Main MetaData etc
    ........MyTab1 MyTab2

    You want this?

    Content Behaviour ToDo
    ....Main MetaData etc
    ........MyTab1
    ........MyTab2

    Where MyTab1 and MyTab2 would show/hide different fieldsets?

  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: new tab on tab in system Link to this post

    Euh... now I'm having a hard time...

    What I'm aiming at is:

    Content is the ancestor of main
    Main is the ancestor of a tabset with 2 or 3 sibling-tabs (MyTab1, MyTab2 etc)

    I guess that's the first option you wrote.

    The second one would be:
    Content is the ancestor of main
    Main is the ancestor of MyTab1
    MyTab1 is the ancestor of MyTab2

    And that's not what I want.

    Oh! Wait! I guess I understand your hard time!
    Forget my second post. I'll try to make myself clear: There is some eyetracking research out on the web that discovered people are reading text's in an F-shape; the horizontals of the F being headings and so on (as long as they understand what they are reading), the verticals of the F being the first word of every plaintext-line, and of everything they don't understand. A link: http://www.useit.com/alertbox/reading_pattern.html

    I expect my backend-users to start reading the form at "Page name" and getting bored if the form appears to long.
    That means a few things:
    1) they would miss everything on the horizontal line of Main, Metadata etc (not only because they simply won't see it, but also because they don't understand what metadata (the second-term) are).
    2) I have some formitems like startdate, starttime, enddate, endtime, contactname, contactemail, eventlocation etc. While SS is ordering formfields below eachother, it would make a pretty long form (too long for my users). So I thought about grouping them on a few tabs (a date-tab, a contact-tab etc.) It would reduce the formlength considerably, and if I order that tabset just below Navigation label (for example), it would work as a new (horizontal) 'heading' in the F-shape.
    I hope this helps ;-)
    (BTW: the possibility to order the shorter date- and time-fields next to each other would be a neat feature)

  • UncleCheese
    Avatar
    4085 Posts

    Re: new tab on tab in system Link to this post

    Easy enough. I'll whip up something for you when I get out of work. Give me a few hours.

    I definitely agree with you about the F patterns, but I think that's why SS puts all the stuff you never use far to the right.

  • UncleCheese
    Avatar
    4085 Posts

    Re: new tab on tab in system Link to this post

    This ought to get you started. Drop this folder in your Silverstripe root and run a flush.

    Usage:

          $fields->addFieldToTab("Root.Content.Main", new VerticalTabSet(
             new VerticalTab('Fruits', array (
                new TextField('Apple'),
                new TextField('Orange')
             )),
             new VerticalTab('Vegetables', array (
                new TextField('Carrot'),
                new TextField('Celery')
             ))
          ));

    Let me know how that works for you.

    Attached Files
    6604 Views
Page: 1 2 3 4
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.