FieldGroup

Lets you include a nested group of fields inside a template.

:fieldgroup2.png

Example usage

Here is an example on using FieldGroup:

new FieldGroup(
	new FieldGroup(
		new HeaderField('FieldGroup 1'),
		new TextField('Firstname')
	),
	new FieldGroup(
		new HeaderField('FieldGroup 2'),
		new TextField('Surname')
	)
)

Using it in the CMS

function getCMSFields() {
	$fields = parent::getCMSFields();
	
	$fields->addFieldToTab(
		'Root.Content.Main', 
		new FieldGroup(
			new TimeField("StartTime","What's the start time?"),
			new TimeField("EndTime","What's the end time?")
		),
		'Content'
	);	
	
	return $fields;
		
}

Displays in the CMS like this.

:fieldgroup_cms.png

API documentation

 
fieldgroup.txt · Last modified: 2009/03/23 08:36

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

blog comments powered by Disqus
 
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