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.

Customising the CMS /

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

new tab on tab in system


Go to End


29 Posts   10922 Views

Avatar
mccarville

Community Member, 32 Posts

16 January 2009 at 1:19pm

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 January 2009 at 1:43pm

In the CMS? should do it automatically.

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

Avatar
mccarville

Community Member, 32 Posts

16 January 2009 at 2:26pm

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 January 2009 at 3:37pm

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!

Avatar
mccarville

Community Member, 32 Posts

17 January 2009 at 4:03am

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

Go to Top