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> * <b>Usage</b>
* *
* <code> * <code>
* new FieldGroup( * FieldGroup::create(
* new FieldGroup( * FieldGroup::create(
* new HeaderField('FieldGroup 1'), * HeaderField::create('FieldGroup 1'),
* new TextField('Firstname') * TextField::create('Firstname')
* ), * ),
* new FieldGroup( * FieldGroup::create(
* new HeaderField('FieldGroup 2'), * HeaderField::create('FieldGroup 2'),
* new TextField('Surname') * TextField::create('Surname')
* ) * )
* ) * )
* </code> * </code>
@ -28,10 +28,10 @@
* $fields = parent::getCMSFields(); * $fields = parent::getCMSFields();
* *
* $fields->addFieldToTab( * $fields->addFieldToTab(
* 'Root.Content', * 'Root.Main',
* new FieldGroup( * FieldGroup::create(
* new TimeField("StartTime","What's the start time?"), * TimeField::create("StartTime","What's the start time?"),
* new TimeField("EndTime","What's the end time?") * TimeField::create("EndTime","What's the end time?")
* ), * ),
* 'Content' * 'Content'
* ); * );
@ -41,6 +41,17 @@
* } * }
* </code> * </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 * @package forms
* @subpackage fields-structural * @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 %> <% 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 %> <% loop $FieldList %>
<div class="fieldgroup-field $FirstLast $EvenOdd"> <div class="fieldgroup-field $FirstLast $EvenOdd">
$SmallFieldHolder $SmallFieldHolder