behaviour in a more specific class
- */
- function Field($properties = array()) {
- $fs = $this->FieldList();
- $spaceZebra = isset($this->zebra) ? " fieldgroup-$this->zebra" : '';
- $idAtt = isset($this->id) ? " id=\"{$this->id}\"" : '';
- $content = "
";
-
- $count = 1;
- foreach($fs as $subfield) {
- $childZebra = (!isset($childZebra) || $childZebra == "odd") ? "even" : "odd";
- if($subfield->hasMethod('setZebra')) {
- $subfield->setZebra($childZebra);
- }
-
- //label the first and last fields of each surrounding div
- if ($count == 1) $firstLast = "first";
- elseif ($count == count($fs)) $firstLast = "last";
- else $firstLast = '';
-
- $content .= "
" . $subfield->{$this->subfieldParam}() . "
";
- $count++;
- }
- $content .= "
";
-
- return $content;
- }
-
- public function setID($id) {
- $this->id = Convert::raw2att($id);
- }
-
/**
* Set an odd/even class
+ *
+ * @param string $zebra one of odd or even.
*/
function setZebra($zebra) {
if($zebra == 'odd' || $zebra == 'even') $this->zebra = $zebra;
@@ -131,47 +96,40 @@ class FieldGroup extends CompositeField {
return $this;
}
- function FieldHolder($properties = array()) {
- $Title = $this->XML_val('Title');
- $Message = $this->XML_val('Message');
- $MessageType = $this->XML_val('MessageType');
- $RightTitle = $this->XML_val('RightTitle');
- $Type = $this->XML_val('Type');
- $extraClass = $this->XML_val('extraClass');
- $Name = $this->XML_val('Name');
- $Field = $this->XML_val('Field');
-
- $titleBlock = (!empty($Title)) ? "
" : "";
- $messageBlock = (!empty($Message)) ? "
$Message" : "";
- $rightTitleBlock = (!empty($RightTitle)) ? "
" : "";
- $id = $Name ? ' id="$Name"' : '';
-
- return <<$titleBlock
$Field
$rightTitleBlock$messageBlock
-HTML;
+ /**
+ * @return string
+ */
+ function getZebra() {
+ return $this->zebra;
}
+ /**
+ * @return string
+ */
function Message() {
$fs = $this->FieldList();
+
foreach($fs as $subfield) {
if($m = $subfield->Message()) $message[] = $m;
}
- if(isset($message)) return implode(", ", $message) . ". ";
+
+ return (isset($message)) ? implode(", ", $message) . ". " : "";
}
- function MessageType(){
+ /**
+ * @return string
+ */
+ function MessageType() {
$fs = $this->FieldList();
+
foreach($fs as $subfield) {
if($m = $subfield->MessageType()) $MessageType[] = $m;
}
- if(isset($MessageType)) {
- return implode(". ", $MessageType);
- }
+
+ return (isset($MessageType)) ? implode(". ", $MessageType) : "";
}
- function php($data){
+ function php($data) {
return;
- }
-
-}
-
+ }
+}
\ No newline at end of file
diff --git a/forms/FileField.php b/forms/FileField.php
index edc365218..c3e88d1b0 100644
--- a/forms/FileField.php
+++ b/forms/FileField.php
@@ -42,8 +42,6 @@
* @subpackage fields-files
*/
class FileField extends FormField {
-
- protected $template = 'FileField';
/**
* Restrict filesize for either all filetypes
@@ -112,8 +110,11 @@ class FileField extends FormField {
}
public function Field($properties = array()) {
- $properties = array_merge($properties, array('MaxFileSize' => $this->getValidator()->getAllowedMaxFileSize()));
- return $this->customise($properties)->renderWith($this->getTemplate());
+ $properties = array_merge($properties, array(
+ 'MaxFileSize' => $this->getValidator()->getAllowedMaxFileSize()
+ ));
+
+ return parent::Field($properties);
}
function getAttributes() {
diff --git a/forms/FileIFrameField.php b/forms/FileIFrameField.php
index e4345a7e7..748df037e 100644
--- a/forms/FileIFrameField.php
+++ b/forms/FileIFrameField.php
@@ -12,8 +12,6 @@
*/
class FileIFrameField extends FileField {
- protected $template = 'FileIFrameField';
-
public static $allowed_actions = array (
'iframe',
'EditFileForm',
diff --git a/forms/FormAction.php b/forms/FormAction.php
index 9c04a9f30..ee1d27671 100644
--- a/forms/FormAction.php
+++ b/forms/FormAction.php
@@ -20,8 +20,6 @@
*/
class FormAction extends FormField {
- protected $template = 'FormAction';
-
protected $action;
/**
@@ -36,12 +34,14 @@ class FormAction extends FormField {
/**
* Create a new action button.
+ *
* @param action The method to call when the button is clicked
* @param title The label on the button
* @param form The parent form, auto-set when the field is placed inside a form
*/
function __construct($action, $title = "", $form = null) {
$this->action = "action_$action";
+
parent::__construct($this->action, $title, null, $form);
}
@@ -67,7 +67,8 @@ class FormAction extends FormField {
'UseButtonTag' => $this->useButtonTag
)
);
- return $this->customise($properties)->renderWith($this->getTemplate());
+
+ return parent::Field($properties);
}
function FieldHolder($properties = array()) {
diff --git a/forms/FormField.php b/forms/FormField.php
index 2baf6ea3e..1bc4bd927 100644
--- a/forms/FormField.php
+++ b/forms/FormField.php
@@ -57,31 +57,35 @@ class FormField extends RequestHandler {
protected $containerFieldSet;
/**
- * @var $readonly boolean
+ * @var boolean
*/
protected $readonly = false;
/**
- * @var $disabled boolean
+ * @var boolean
*/
protected $disabled = false;
/**
- * @var String
- */
- protected $template = 'FormField';
-
- /**
- * @var Custom Validation Message for the Field
+ * @var string custom validation message for the Field
*/
protected $customValidationMessage = "";
-
+
/**
- * Template name to render this FormField field holder into.
+ * Name of the template used to render this form field. If not set, then
+ * will look up the class ancestry for the first matching template where
+ * the template name equals the class name.
+ *
+ * To explicitly use a custom template or one named other than the form
+ * field see {@link setTemplate()}, {@link setFieldHolderTemplate()}
+ *
* @var string
*/
- protected $fieldHolderTemplate = 'FieldHolder';
-
+ protected
+ $template,
+ $fieldHolderTemplate,
+ $smallFieldHolderTemplate;
+
/**
* @var array All attributes on the form field (not the field holder).
* Partially determined based on other instance properties, please use {@link getAttributes()}.
@@ -268,7 +272,7 @@ class FormField extends RequestHandler {
* Uses {@link Message()} and {@link MessageType()} to add validatoin
* error classes which can be used to style the contained tags.
*
- * @return String CSS-classnames
+ * @return string CSS-classnames
*/
function extraClass() {
$classes = array();
@@ -323,8 +327,8 @@ class FormField extends RequestHandler {
* CreditCardField, CurrencyField, DateField, DatetimeField, FieldGroup, GridField, HtmlEditorField,
* ImageField, ImageFormAction, InlineFormAction, ListBoxField, etc.
*
- * @param String
- * @param String
+ * @param string
+ * @param string
*/
function setAttribute($name, $value) {
$this->attributes[$name] = $value;
@@ -335,7 +339,7 @@ class FormField extends RequestHandler {
* Get an HTML attribute defined by the field, or added through {@link setAttribute()}.
* Caution: Doesn't work on all fields, see {@link setAttribute()}.
*
- * @return String
+ * @return string
*/
function getAttribute($name) {
$attrs = $this->getAttributes();
@@ -355,13 +359,14 @@ class FormField extends RequestHandler {
'disabled' => $this->isDisabled(),
'title' => $this->getDescription(),
);
+
return array_merge($attrs, $this->attributes);
}
/**
* @param Array Custom attributes to process. Falls back to {@link getAttributes()}.
* If at least one argument is passed as a string, all arguments act as excludes by name.
- * @return String HTML attributes, ready for insertion into an HTML tag
+ * @return string HTML attributes, ready for insertion into an HTML tag
*/
function getAttributesHTML($attrs = null) {
$exclude = (is_string($attrs)) ? func_get_args() : null;
@@ -431,28 +436,7 @@ class FormField extends RequestHandler {
function getForm() {
return $this->form;
}
-
- /**
- * @return String
- */
- public function getFieldHolderTemplate() {
- return $this->fieldHolderTemplate;
- }
-
- /**
- * Set name of template (without path or extension) for the holder,
- * which in turn is responsible for rendering {@link Field()}.
- *
- * Caution: Not consistently implemented in all subclasses,
- * please check the {@link Field()} method on the subclass for support.
- *
- * @param String
- */
- public function setFieldHolderTemplate($template) {
- $this->fieldHolderTemplate = $template;
- return $this;
- }
-
+
/**
* Return TRUE if security token protection is enabled on the parent {@link Form}.
*
@@ -461,6 +445,7 @@ class FormField extends RequestHandler {
public function securityTokenEnabled() {
$form = $this->getForm();
if(!$form) return false;
+
return $form->getSecurityToken()->isEnabled();
}
@@ -471,6 +456,7 @@ class FormField extends RequestHandler {
function setError($message, $messageType) {
$this->message = $message;
$this->messageType = $messageType;
+
return $this;
}
@@ -479,10 +465,11 @@ class FormField extends RequestHandler {
* format of Please Fill In XXX. Different from setError() as
* that appends it to the standard error messaging
*
- * @param String Message for the error
+ * @param string Message for the error
*/
public function setCustomValidationMessage($msg) {
$this->customValidationMessage = $msg;
+
return $this;
}
@@ -492,7 +479,7 @@ class FormField extends RequestHandler {
* error is defined on {@link Validator}.
*
* @todo Should the default error message be stored here instead
- * @return String
+ * @return string
*/
public function getCustomValidationMessage() {
return $this->customValidationMessage;
@@ -503,20 +490,65 @@ class FormField extends RequestHandler {
* Caution: Not consistently implemented in all subclasses,
* please check the {@link Field()} method on the subclass for support.
*
- * @param String
+ * @param string
*/
function setTemplate($template) {
$this->template = $template;
+
return $this;
}
/**
- * @return String
+ * @return string
*/
function getTemplate() {
return $this->template;
}
+ /**
+ * @return string
+ */
+ public function getFieldHolderTemplate() {
+ return $this->fieldHolderTemplate;
+ }
+
+ /**
+ * Set name of template (without path or extension) for the holder,
+ * which in turn is responsible for rendering {@link Field()}.
+ *
+ * Caution: Not consistently implemented in all subclasses,
+ * please check the {@link Field()} method on the subclass for support.
+ *
+ * @param string
+ */
+ public function setFieldHolderTemplate($template) {
+ $this->fieldHolderTemplate = $template;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSmallFieldHolderTemplate() {
+ return $this->smallFieldHolderTemplate;
+ }
+
+ /**
+ * Set name of template (without path or extension) for the small holder,
+ * which in turn is responsible for rendering {@link Field()}.
+ *
+ * Caution: Not consistently implemented in all subclasses,
+ * please check the {@link Field()} method on the subclass for support.
+ *
+ * @param string
+ */
+ public function setSmallFieldHolderTemplate($template) {
+ $this->smallFieldHolderTemplate = $template;
+
+ return $this;
+ }
+
/**
* Returns the form field - used by templates.
* Although FieldHolder is generally what is inserted into templates, all of the field holder
@@ -529,7 +561,8 @@ class FormField extends RequestHandler {
*/
function Field($properties = array()) {
$obj = ($properties) ? $this->customise($properties) : $this;
- return $obj->renderWith($this->getTemplate());
+
+ return $obj->renderWith($this->getTemplates());
}
/**
@@ -544,28 +577,80 @@ class FormField extends RequestHandler {
*/
function FieldHolder($properties = array()) {
$obj = ($properties) ? $this->customise($properties) : $this;
- return $obj->renderWith($this->getFieldHolderTemplate());
+
+ return $obj->renderWith($this->getFieldHolderTemplates());
}
/**
* Returns a restricted field holder used within things like FieldGroups.
+ *
+ * @param array $properties
+ *
+ * @return string
*/
- function SmallFieldHolder() {
- $result = '';
- // set label
- if($title = $this->RightTitle()){
- $result .= " HTML tag. Default: 2
@@ -53,5 +53,4 @@ class HeaderField extends DatalessField {
function Type() {
return null;
}
-
}
\ No newline at end of file
diff --git a/forms/HiddenField.php b/forms/HiddenField.php
index ddb9ff9c0..ddd26c2a1 100644
--- a/forms/HiddenField.php
+++ b/forms/HiddenField.php
@@ -1,13 +1,12 @@
Field($properties);
}
diff --git a/forms/LabelField.php b/forms/LabelField.php
index 6f6974e35..7440461b8 100644
--- a/forms/LabelField.php
+++ b/forms/LabelField.php
@@ -8,8 +8,6 @@
* @subpackage fields-dataless
*/
class LabelField extends DatalessField {
-
- protected $template = 'LabelField';
/**
* @param string $name
diff --git a/forms/ListboxField.php b/forms/ListboxField.php
index 0c07535c1..4b8ecf898 100644
--- a/forms/ListboxField.php
+++ b/forms/ListboxField.php
@@ -64,6 +64,7 @@ class ListboxField extends DropdownField {
function __construct($name, $title = '', $source = array(), $value = '', $size = null, $multiple = false) {
if($size) $this->size = $size;
if($multiple) $this->multiple = $multiple;
+
parent::__construct($name, $title, $source, $value);
}
@@ -96,8 +97,12 @@ class ListboxField extends DropdownField {
));
}
}
- $properties = array_merge($properties, array('Options' => new ArrayList($options)));
- return $this->customise($properties)->renderWith($this->getTemplate());
+
+ $properties = array_merge($properties, array(
+ 'Options' => new ArrayList($options)
+ ));
+
+ return $this->customise($properties)->renderWith($this->getTemplates());
}
function getAttributes() {
diff --git a/forms/OptionsetField.php b/forms/OptionsetField.php
index 353f8201d..fcf0670fb 100644
--- a/forms/OptionsetField.php
+++ b/forms/OptionsetField.php
@@ -55,8 +55,6 @@
* @subpackage fields-basic
*/
class OptionsetField extends DropdownField {
-
- protected $template = 'OptionsetField';
/**
* @var Array
@@ -67,6 +65,7 @@ class OptionsetField extends DropdownField {
$source = $this->getSource();
$odd = 0;
$options = array();
+
if($source) {
foreach($source as $value => $title) {
$itemID = $this->ID() . '_' . preg_replace('/[^a-zA-Z0-9]/', '', $value);
@@ -86,9 +85,13 @@ class OptionsetField extends DropdownField {
}
}
- $properties = array_merge($properties, array('Options' => new ArrayList($options)));
+ $properties = array_merge($properties, array(
+ 'Options' => new ArrayList($options)
+ ));
- return $this->customise($properties)->renderWith($this->getTemplate());
+ return $this->customise($properties)->renderWith(
+ $this->getTemplates()
+ );
}
function performReadonlyTransformation() {
@@ -97,6 +100,7 @@ class OptionsetField extends DropdownField {
$field = new LookupField($this->name, $this->title ? $this->title : '', $items, $this->value);
$field->setForm($this->form);
$field->setReadonly(true);
+
return $field;
}
diff --git a/forms/SelectionGroup.php b/forms/SelectionGroup.php
index bc95395eb..83d941917 100644
--- a/forms/SelectionGroup.php
+++ b/forms/SelectionGroup.php
@@ -1,15 +1,15 @@
customise($properties) : $this;
-
- return $obj->renderWith($this->template);
+
+ return $obj->renderWith($this->getTemplates());
}
}
diff --git a/forms/TabSet.php b/forms/TabSet.php
index 03ff06689..2c2cb8d42 100644
--- a/forms/TabSet.php
+++ b/forms/TabSet.php
@@ -27,8 +27,6 @@
*/
class TabSet extends CompositeField {
- protected $template = "TabSetFieldHolder";
-
/**
* @param string $name Identifier
* @param string $title (Optional) Natural language title of the tabset
@@ -81,7 +79,8 @@ class TabSet extends CompositeField {
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TabSet.js');
$obj = $properties ? $this->customise($properties) : $this;
- return $obj->renderWith($this->template);
+
+ return $obj->renderWith($this->getTemplates());
}
/**
@@ -90,6 +89,7 @@ class TabSet extends CompositeField {
public function Tabs() {
return $this->children;
}
+
public function setTabs($children){
$this->children = $children;
}
diff --git a/forms/TextField.php b/forms/TextField.php
index 41e08910c..1a990bc8c 100644
--- a/forms/TextField.php
+++ b/forms/TextField.php
@@ -1,15 +1,14 @@
maxLength = $length;
+
return $this;
}
/**
- * @return Int
+ * @return int
*/
function getMaxLength() {
return $this->maxLength;
@@ -50,6 +50,5 @@ class TextField extends FormField {
function InternallyLabelledField() {
if(!$this->value) $this->value = $this->Title();
return $this->Field();
- }
-
+ }
}
\ No newline at end of file
diff --git a/forms/TextareaField.php b/forms/TextareaField.php
index 58f51fa28..7efa85db1 100644
--- a/forms/TextareaField.php
+++ b/forms/TextareaField.php
@@ -21,16 +21,14 @@
* @subpackage fields-basic
*/
class TextareaField extends FormField {
-
- protected $template = 'TextareaField';
-
+
/**
- * @var Int Visible number of text lines.
+ * @var int Visible number of text lines.
*/
protected $rows = 5;
/**
- * @var Int Width of the text area (in average character widths)
+ * @var int Width of the text area (in average character widths)
*/
protected $cols = 20;
@@ -60,13 +58,14 @@ class TextareaField extends FormField {
}
function getTemplate() {
- return ($this->isReadonly()) ? "{$this->template}_Readonly" : $this->template;
+ return ($this->isReadonly()) ? "{$this->template}_readonly" : $this->template;
}
/**
- * Performs a readonly transformation on this field. You should still be able
- * to copy from this field, and it should still send when you submit
+ * Performs a readonly transformation on this field. You should still be
+ * able to copy from this field, and it should still send when you submit
* the form it's attached to.
+ *
* The element shouldn't be both disabled and readonly at the same time.
*/
function performReadonlyTransformation() {
@@ -80,6 +79,7 @@ class TextareaField extends FormField {
* Performs a disabled transformation on this field. You shouldn't be able to
* copy from this field, and it should not send any data when you submit the
* form it's attached to.
+ *
* The element shouldn't be both disabled and readonly at the same time.
*/
function performDisabledTransformation() {
diff --git a/forms/ToggleCompositeField.php b/forms/ToggleCompositeField.php
index 02607baba..5ab7262f0 100644
--- a/forms/ToggleCompositeField.php
+++ b/forms/ToggleCompositeField.php
@@ -1,13 +1,12 @@
customise($properties) : $this;
- return $obj->renderWith($this->template);
+
+ return $obj->renderWith($this->getTemplates());
}
/**
@@ -41,7 +41,7 @@ class ToggleCompositeField extends CompositeField {
}
/**
- * @return String
+ * @return string
*/
public function HeadingLevel() {
return $this->headingLevel;
diff --git a/forms/UploadField.php b/forms/UploadField.php
index 556f7dc87..c3d534c5d 100644
--- a/forms/UploadField.php
+++ b/forms/UploadField.php
@@ -44,11 +44,6 @@ class UploadField extends FileField {
'$Action!' => '$Action',
);
- /**
- * @var String
- */
- protected $template = 'UploadField';
-
/**
* @var String
*/
@@ -375,13 +370,15 @@ class UploadField extends FileField {
if (is_numeric($config['maxNumberOfFiles']) && $this->getItems()->count()) {
$configOverwrite['maxNumberOfFiles'] = $config['maxNumberOfFiles'] - $this->getItems()->count();
}
+
$config = array_merge($config, $this->ufConfig, $configOverwrite);
+
return $this->customise(array(
'configString' => str_replace('"', "'", Convert::raw2json($config)),
'config' => new ArrayData($config),
'multiple' => $config['maxNumberOfFiles'] !== 1,
'displayInput' => (!isset($configOverwrite['maxNumberOfFiles']) || $configOverwrite['maxNumberOfFiles'])
- ))->renderWith($this->getTemplate());
+ ))->renderWith($this->getTemplates());
}
/**
diff --git a/forms/gridfield/GridFieldDetailForm.php b/forms/gridfield/GridFieldDetailForm.php
index e7dc55fdc..f700e70f9 100755
--- a/forms/gridfield/GridFieldDetailForm.php
+++ b/forms/gridfield/GridFieldDetailForm.php
@@ -12,8 +12,6 @@
*/
class GridFieldDetailForm implements GridField_URLHandler {
-
-
/**
* @var String
*/
diff --git a/scss/GridField.scss b/scss/GridField.scss
index dcb0f808f..c795dab47 100644
--- a/scss/GridField.scss
+++ b/scss/GridField.scss
@@ -375,8 +375,8 @@ $gf_grid_x: 16px;
}
&.ss-gridfield-button-filter.ss-ui-button{
position:absolute;
- right:5px; //positions filter button in correct position on top of input field
- top:-28px;
+ top: 0;
+ right: 0;
display:block;
text-indent:-9999em;
width:30px;
@@ -412,8 +412,8 @@ $gf_grid_x: 16px;
}
&.ss-gridfield-button-reset.ss-ui-button{
position:absolute;
- right:34px; //positions reset button in correct position on top of input field and to the left of the filter button
- top:-28px;
+ right: 29px;
+ top: 0;
display:block;
text-indent:-9999em;
width:30px;
diff --git a/templates/forms/CheckboxFieldHolder.ss b/templates/forms/CheckboxField_holder.ss
similarity index 100%
rename from templates/forms/CheckboxFieldHolder.ss
rename to templates/forms/CheckboxField_holder.ss
diff --git a/templates/forms/CheckboxField_holder_small.ss b/templates/forms/CheckboxField_holder_small.ss
new file mode 100644
index 000000000..3f8a501fb
--- /dev/null
+++ b/templates/forms/CheckboxField_holder_small.ss
@@ -0,0 +1,5 @@
+<% if $Title %>
+
+<% end_if %>
+
+$Field
\ No newline at end of file
diff --git a/templates/forms/CheckboxSetField_Select.ss b/templates/forms/CheckboxSetField_Select.ss
deleted file mode 100644
index f1eb1e6fb..000000000
--- a/templates/forms/CheckboxSetField_Select.ss
+++ /dev/null
@@ -1,11 +0,0 @@
-<%-- Renders a CheckboxField with $multiple=true as a select element which can save into relations.--%>
-<%-- TODO Make relation saving available on ListboxField --%>
-
\ No newline at end of file
diff --git a/templates/forms/CompositeField.ss b/templates/forms/CompositeField.ss
new file mode 100644
index 000000000..452f1c979
--- /dev/null
+++ b/templates/forms/CompositeField.ss
@@ -0,0 +1,15 @@
+<$Tag class="CompositeField $extraClass <% if ColumnCount %>multicolumn<% end_if %>">
+ <% if $Tag == 'fieldset' && $Legend %>
+
+ <% end_if %>
+
+ <% loop FieldList %>
+ <% if ColumnCount %>
+
+ $Field
+
+ <% else %>
+ $Field
+ <% end_if %>
+ <% end_loop %>
+$Tag>
\ No newline at end of file
diff --git a/templates/forms/CompositeField_holder.ss b/templates/forms/CompositeField_holder.ss
new file mode 100644
index 000000000..aef9f58ae
--- /dev/null
+++ b/templates/forms/CompositeField_holder.ss
@@ -0,0 +1,15 @@
+<$Tag class="CompositeField $extraClass <% if ColumnCount %>multicolumn<% end_if %>">
+ <% if $Tag == 'fieldset' && $Legend %>
+
+ <% end_if %>
+
+ <% loop FieldList %>
+ <% if ColumnCount %>
+
+ $FieldHolder
+
+ <% else %>
+ $FieldHolder
+ <% end_if %>
+ <% end_loop %>
+$Tag>
\ No newline at end of file
diff --git a/templates/forms/CompositeField_holder_small.ss b/templates/forms/CompositeField_holder_small.ss
new file mode 100644
index 000000000..9f5e38629
--- /dev/null
+++ b/templates/forms/CompositeField_holder_small.ss
@@ -0,0 +1,15 @@
+<$Tag class="field CompositeField $extraClass <% if ColumnCount %>multicolumn<% end_if %>">
+ <% if $Tag == 'fieldset' && $Legend %>
+
+ <% end_if %>
+
+ <% loop FieldList %>
+ <% if ColumnCount %>
+
+ $SmallFieldHolder
+
+ <% else %>
+ $SmallFieldHolder
+ <% end_if %>
+ <% end_loop %>
+$Tag>
\ No newline at end of file
diff --git a/templates/forms/FieldGroup.ss b/templates/forms/FieldGroup.ss
new file mode 100644
index 000000000..e0590d0c2
--- /dev/null
+++ b/templates/forms/FieldGroup.ss
@@ -0,0 +1,7 @@
+id="$ID"<% end_if %>>
+ <% loop FieldList %>
+
+ $SmallFieldHolder
+
+ <% end_loop %>
+
\ No newline at end of file
diff --git a/templates/forms/FieldGroup_holder.ss b/templates/forms/FieldGroup_holder.ss
new file mode 100644
index 000000000..423baae1c
--- /dev/null
+++ b/templates/forms/FieldGroup_holder.ss
@@ -0,0 +1,13 @@
+id="$Name"<% end_if %> class="field $Type $extraClass">
+ <% if Title %>
<% end_if %>
+
+
+ <% loop FieldList %>
+
+ $SmallFieldHolder
+
+ <% end_loop %>
+
+ <% if RightTitle %>
<% end_if %>
+ <% if Message %>
$Message<% end_if %>
+
\ No newline at end of file
diff --git a/templates/forms/FieldHolder.ss b/templates/forms/FormField_holder.ss
similarity index 100%
rename from templates/forms/FieldHolder.ss
rename to templates/forms/FormField_holder.ss
diff --git a/templates/forms/FormField_holder_small.ss b/templates/forms/FormField_holder_small.ss
new file mode 100644
index 000000000..4360afac5
--- /dev/null
+++ b/templates/forms/FormField_holder_small.ss
@@ -0,0 +1,11 @@
+
+ <% if $RightTitle %>
+
+ <% else_if $LeftTitle %>
+
+ <% else_if $Title %>
+
+ <% end_if %>
+
+ $Field
+
\ No newline at end of file
diff --git a/templates/SelectionGroup.ss b/templates/forms/SelectionGroup.ss
similarity index 100%
rename from templates/SelectionGroup.ss
rename to templates/forms/SelectionGroup.ss
diff --git a/templates/TabSetFieldHolder.ss b/templates/forms/TabSet.ss
similarity index 100%
rename from templates/TabSetFieldHolder.ss
rename to templates/forms/TabSet.ss
diff --git a/templates/ToggleCompositeField.ss b/templates/forms/ToggleCompositeField.ss
similarity index 100%
rename from templates/ToggleCompositeField.ss
rename to templates/forms/ToggleCompositeField.ss
diff --git a/tests/forms/CompositeFieldTest.php b/tests/forms/CompositeFieldTest.php
index 8c4f3e938..090dd5fd1 100644
--- a/tests/forms/CompositeFieldTest.php
+++ b/tests/forms/CompositeFieldTest.php
@@ -15,7 +15,7 @@ class CompositeFieldTest extends SapphireTest {
),
new TextField('D')
);
-
+
$this->assertEquals(0, $compositeOuter->fieldPosition('A'));
$this->assertEquals(1, $compositeOuter->fieldPosition('B'));
$this->assertEquals(3, $compositeOuter->fieldPosition('D'));
@@ -30,16 +30,18 @@ class CompositeFieldTest extends SapphireTest {
}
function testTag() {
- $composite = new CompositeField(
+ $div = new CompositeField(
new TextField('A'),
new TextField('B')
);
- $this->assertStringStartsWith('FieldHolder()));
- $this->assertStringEndsWith('/div>', trim($composite->FieldHolder()));
+ $this->assertStringStartsWith('
FieldHolder()));
+ $this->assertStringEndsWith('/div>', trim($div->FieldHolder()));
+
+ $fieldset = new CompositeField();
+ $fieldset->setTag('fieldset');
- $composite->setTag('fieldset');
- $this->assertStringStartsWith('