Hi All
I'd like to add a new set of tabs for my Page class, basically a Custom tab at the Content/Behaviour/To-Do level, and then another set of tabs underneath that tab. Unfortunately when I try to do so I get an error.
Let me be more specific -> when I add just a top level tab (that is addFieldToTab('Root.Custom',field) ) it works great, and if I try to add a sub tab to an already existing top level tab (eg addFieldToTab('Root.Content.Custom',field) ) it works fine too, but if I try to add a sub tab to the new top level tab (eg addFieldToTab('Root.Custom.Custom') ) this is when I get errors.
Below is a basic sample that I've used in Page.php and should replicate the error. If you remove the 'offending line' below, it should work. Leave it in and you'll get
FieldSet::addFieldToTab() Tried to add a tab to object 'Tab' named 'Custom' - 'CustomSub' didn't exist.
Line 272 in /path/to/silverstripe../sapphire/forms/FieldSet.php
Here's the snippet:
static $db = array(
'Test1' => 'Text',
'Test2' => 'Text',
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Custom', new TextField('Test1'));
$fields->addFieldToTab('Root.Custom.CustomSub', new TextField('Test2')); // The offending row
return $fields;
}
I am using a very recent checkout of the 2.4 branch if that matters, but I'd have expected this to be pretty core functionality.
Also, I've come across this in my hunting http://silverstripe.org/customising-the-cms/show/252514#post252514 which I'm a bit afraid of - it seems to be the same issue, but is from over 12 months ago. Reeally hoping there's been a fix for this since?
Would really appreciate your help forum peeps!