getCMSFields

This is the method you need to call to add / remove / edit fields in the CMS. For a tutorial on how to add your own fields to the CMS see tutorial 2 which covers how to add fields to your page types

Adding Fields / Tabs

// add a another textbox under the Content tab
$fields->addFieldToTab("Root.Content", new TextField("ExtraContent", "Extra Content"));
 
// Make a new tab 'BioPic' and add a image field
$fields->addFieldToTab("Root.BioPic", new ImageField("Picture", "Staff Photo"));

Removing Fields / Tabs

// remove the content text area 
$fields->removeFieldFromTab("Root.Content.Main","Content");
 
// remove the whole reports tab
$fields->removeFieldFromTab("Root","Reports");

Renaming Fields

// Don't like the title for 'Content'?
$fields->renameField("Content", "A better Title for Content");
 
getcmsfields.txt · Last modified: 2010/05/05 23:38 (external edit)

Please use comments for notes, tips and corrections about the described functionality.
Use the Silverstripe Forum to ask questions.

blog comments powered by Disqus
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Creative Commons LicenseSilverStripe Documentation by SilverStripe is licensed under a Creative Commons Attribution 3.0 New Zealand License.
Based on a work at doc.silverstripe.com
Recent changes RSS feed Driven by DokuWiki