From 14044fff358efe8d33c599114f8975f9c23e4db9 Mon Sep 17 00:00:00 2001 From: Cam Findlay Date: Tue, 8 Mar 2016 16:18:49 +1300 Subject: [PATCH] DOCS Added a useful code example around positioning of tabs in CMS. This useful example wasn't in the docs when I needed it. I ended up tracking this information down at http://stackoverflow.com/questions/5033028/silverstripe-how-do-i-insert-a-tab-before-another-tab It should really be in the docs. --- .../en/02_Developer_Guides/03_Forms/00_Introduction.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/en/02_Developer_Guides/03_Forms/00_Introduction.md b/docs/en/02_Developer_Guides/03_Forms/00_Introduction.md index 78d03bea9..7649bc4d8 100644 --- a/docs/en/02_Developer_Guides/03_Forms/00_Introduction.md +++ b/docs/en/02_Developer_Guides/03_Forms/00_Introduction.md @@ -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.