mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #5156 from camfindlay/patch-38
DOCS Added a useful code example around positioning of tabs in CMS.
This commit is contained in:
commit
de044e591b
@ -126,13 +126,17 @@ A field can be appended to the [api:FieldList].
|
||||
$fields = $form->Fields();
|
||||
|
||||
// add a field
|
||||
$fields->push(new TextField(..));
|
||||
$fields->push(TextField::create(..));
|
||||
|
||||
// insert a field before another one
|
||||
$fields->insertBefore(new TextField(..), 'Email');
|
||||
$fields->insertBefore(TextField::create(..), 'Email');
|
||||
|
||||
// insert a field after another one
|
||||
$fields->insertAfter(new TextField(..), 'Name');
|
||||
$fields->insertAfter(TextField::create(..), 'Name');
|
||||
|
||||
// insert a tab before the main content tab (used to position tabs in the CMS)
|
||||
$fields->insertBefore(Tab::create(...), 'Main');
|
||||
// Note: you need to create and position the new tab prior to adding fields via addFieldToTab()
|
||||
|
||||
Fields can be fetched after they have been added in.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user