This document contains information for an outdated version and may not be maintained any more. If some of your projects still use this version, consider upgrading as soon as possible.
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.
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.
Adding a field to a tab
$fields->addFieldToTab('Root.Main', new TextField(..));
Removing a field from a tab
Creating a new tab
$fields->addFieldToTab('Root.MyNewTab', new TextField(..));
Moving a field between tabs
$content = $fields->dataFieldByName('Content'); $fields->removeFieldFromTab('Root.Main', 'Content'); $fields->addFieldToTab('Root.MyContent', $content);
Add multiple fields at once
$fields->addFieldsToTab('Root.Content', array( TextField::create('Name'), TextField::create('Email') ));