Jump to:

5451 Posts in 1673 Topics by 1197 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: 6377 Views
  • mccarville
    Avatar
    Community Member
    32 Posts

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

    can anyone give me some direction on how to make a regular horizontal tabset? Do you just leave the vertical off?

  • UncleCheese
    Avatar
    4085 Posts

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

    In the CMS? should do it automatically.

    $fields->addFieldToTab("Root.Content.Main.Foo", new TextField('Bar'));

  • mccarville
    Avatar
    Community Member
    32 Posts

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

    very nice

    can I add an addiitonal level?

    $fields->addFieldToTab("Root.Content.Main.Foo.Bar", new TextField('Bar'));

    I really appreciate the help... about 10 days in and I feel like I found the most amazing thing ever...

  • UncleCheese
    Avatar
    4085 Posts

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

    Haha.. I know the feeling. It's like.. finally, a CMS that doesn't get in my way! It does whatever I need it to do!

  • mccarville
    Avatar
    Community Member
    32 Posts

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

    I tried what you sggested. The build went fine, but when I tried to create the page type in the CMS I got a pop-up window an error... any thoughts???

    MY .php File
    ---------------------------------------
    <?php

    class test extends Page {
       
       static $db = array(   
       '1' => 'Text',
       '2' => 'Text',
       '3' => 'Text',
       '4' => 'Text',
       '5' => 'Text',
       );
       
       static $has_one = array(
    );

    static $defaults = array(
    'ProvideComments' => true
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab('Root.Content.Main.Profile', new TextField('1'));
    $fields->addFieldToTab('Root.Content.Main.Subject1', new TextField('2'));
    $fields->addFieldToTab('Root.Content.Main.Subject2', new TextField('3'));
    $fields->addFieldToTab('Root.Content.Main.subject3', new TextField('4'));
    $fields->addFieldToTab('Root.Content.Main.Subject4', new TextField('5'));
          
    return $fields;}

    }

    class test_Controller extends Page_Controller {
       
    }

    ?>

    -------------------

    The Error
    ---------------------------------------
    ERROR:Error 256: FieldSet::addFieldToTab() Tried to add a tab to a Tab object - 'Profile' didn't exist.
    At l142 in C:\wamp\www\ss\sapphire\forms\FieldSet.php
    user_error(FieldSet::addFieldToTab() Tried to add a tab to a Tab object - 'Profile' didn't exist.,256)
    line 142 of FieldSet.php

    FieldSet->findOrMakeTab(Root.Content.Main.Profile)
    line 55 of FieldSet.php

    FieldSet->addFieldToTab(Root.Content.Main.Profile,TextField)
    line 24 of test.php

    test->getCMSFields(CMSMain)
    line 363 of CMSMain.php

    CMSMain->getEditForm(18)
    line 752 of LeftAndMain.php

    LeftAndMain->EditForm()
    line 227 of LeftAndMain.php

    LeftAndMain->getitem(Array)
    line 261 of Controller.php

    Controller->run(Array)
    line 104 of Director.php

    Director::direct(/admin/getitem)
    line 158 of main.php

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