mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-08 18:51:12 +02:00
- Remaining Developer Guides and Upgrading - SilverStripe in a namespace or api has not been change - To keep PRs easier no formatting was changed Update merge conflics with two files Update Silverstripe Ltd, Silverstripe Cloud and Silverstripe CMS Silverstripe CMS Ltd > Silverstripe Ltd Silverstripe CMS Platform > Silverstripe Cloud Silverstripe CMS Framework > Silverstripe CMS Resolve merge conflict Remove Framework from Silverstripe CMS Framework - 3 files Change SilverStripe CMS to Silverstripe CMS
1.9 KiB
1.9 KiB
title | summary |
---|---|
Tabbed Forms | Find out how CMS interfaces use jQuery UI tabs to provide nested FormFields. |
Tabbed Forms
Silverstripe CMS'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. [/notice]
Adding a field to a tab
$fields->addFieldToTab('Root.Main', new TextField(..));
Removing a field from a tab
$fields->removeFieldFromTab('Root.Main', 'Content');
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', [
TextField::create('Name'),
TextField::create('Email')
]);