Tabbed Forms
SilverStripe's FormScaffolder can automatically generate Form instances for certain database models. In the CMS and other scaffolded interfaces, it will output TabSet and Tab objects and use jQuery Tabs to split parts of the data model.
[notice] All interfaces within the CMS such as ModelAdmin and LeftAndMain use tabbed interfaces by default. [/notice]
When dealing with tabbed forms, modifying the fields in the form has a few differences. Each Tab will be given a
name, and normally they all exist under the Root
TabSet.
[notice] TabSet instances can contain child Tab and further TabSet instances, however the CMS UI will only display up to two levels of tabs in the interface. If you want to group data further than that, try ToggleField. [/notice]
Adding a field to a tab
$fields->addFieldToTab('Root.Main', new TextField(..));
$fields->removeFieldFromTab('Root.Main', 'Content');
$fields->addFieldToTab('Root.MyNewTab', new TextField(..));
$content = $fields->dataFieldByName('Content');
$fields->removeFieldFromTab('Root.Main', 'Content');
$fields->addFieldToTab('Root.MyContent', $content);
$fields->addFieldsToTab('Root.Content', array(
TextField::create('Name'),
TextField::create('Email')
));