Updated fieldgroup class and example code

This commit is contained in:
Arno Poot 2013-07-26 16:01:24 +02:00
parent 541436feb0
commit b68cd6610c
2 changed files with 24 additions and 13 deletions

View File

@ -9,14 +9,14 @@
* <b>Usage</b>
*
* <code>
* new FieldGroup(
* new FieldGroup(
* new HeaderField('FieldGroup 1'),
* new TextField('Firstname')
* FieldGroup::create(
* FieldGroup::create(
* HeaderField::create('FieldGroup 1'),
* TextField::create('Firstname')
* ),
* new FieldGroup(
* new HeaderField('FieldGroup 2'),
* new TextField('Surname')
* FieldGroup::create(
* HeaderField::create('FieldGroup 2'),
* TextField::create('Surname')
* )
* )
* </code>
@ -28,10 +28,10 @@
* $fields = parent::getCMSFields();
*
* $fields->addFieldToTab(
* 'Root.Content',
* new FieldGroup(
* new TimeField("StartTime","What's the start time?"),
* new TimeField("EndTime","What's the end time?")
* 'Root.Main',
* FieldGroup::create(
* TimeField::create("StartTime","What's the start time?"),
* TimeField::create("EndTime","What's the end time?")
* ),
* 'Content'
* );
@ -40,6 +40,17 @@
*
* }
* </code>
*
* <b>Setting a title to a FieldGroup</b>
*
* <code>
* $fields->addFieldToTab("Root.Main",
* FieldGroup::create(
* TimeField::create('StartTime','What's the start time?'),
* TimeField::create('EndTime', 'What's the end time?')
* )->setTitle('Time')
* );
* </code>
*
* @package forms
* @subpackage fields-structural

View File

@ -1,7 +1,7 @@
<div <% if $Name %>id="$Name"<% end_if %> class="field $Type $extraClass">
<div <% if $Name %>id="$Name"<% end_if %> class="field $Type">
<% if $Title %><label class="left">$Title</label><% end_if %>
<div class="middleColumn fieldgroup <% if Zebra %>fieldgroup-$Zebra<% end_if %>">
<div class="middleColumn fieldgroup<% if $Zebra %> fieldgroup-$Zebra<% end_if %>">
<% loop $FieldList %>
<div class="fieldgroup-field $FirstLast $EvenOdd">
$SmallFieldHolder