diff --git a/admin/themes/cms-forms/templates/forms/CompositeField.ss b/admin/themes/cms-forms/templates/forms/CompositeField.ss
new file mode 100644
index 000000000..702c7b286
--- /dev/null
+++ b/admin/themes/cms-forms/templates/forms/CompositeField.ss
@@ -0,0 +1,6 @@
+<% if $Tag == 'fieldset' && $Legend %>
+
+<% end_if %>
+<% loop $FieldList %>
+ $FieldHolder
+<% end_loop %>
diff --git a/admin/themes/cms-forms/templates/forms/CompositeField_holder.ss b/admin/themes/cms-forms/templates/forms/CompositeField_holder.ss
new file mode 100644
index 000000000..1501d30e6
--- /dev/null
+++ b/admin/themes/cms-forms/templates/forms/CompositeField_holder.ss
@@ -0,0 +1,17 @@
+
diff --git a/admin/themes/cms-forms/templates/forms/CompositeField_holder_small.ss b/admin/themes/cms-forms/templates/forms/CompositeField_holder_small.ss
new file mode 100644
index 000000000..70f086cd0
--- /dev/null
+++ b/admin/themes/cms-forms/templates/forms/CompositeField_holder_small.ss
@@ -0,0 +1,17 @@
+
diff --git a/admin/themes/cms-forms/templates/forms/SelectionGroup.ss b/admin/themes/cms-forms/templates/forms/SelectionGroup.ss
index aef8a6bc4..678aac5b5 100644
--- a/admin/themes/cms-forms/templates/forms/SelectionGroup.ss
+++ b/admin/themes/cms-forms/templates/forms/SelectionGroup.ss
@@ -1,21 +1,25 @@
-
-
+ <% end_if %>
+ <% end_loop %>
+ <% else %>
+ <% loop $FieldSet %>
+
+ {$RadioButton}{$RadioLabel}
+ <%-- Bypass composite item field and directly render child fields --%>
+ <% loop $FieldList %>
+ $Field
+ <% end_loop %>
+
+ <% end_loop %>
+ <% end_if %>
+
diff --git a/forms/SelectionGroup.php b/forms/SelectionGroup.php
index caedf41d9..0790916d3 100644
--- a/forms/SelectionGroup.php
+++ b/forms/SelectionGroup.php
@@ -82,6 +82,7 @@ class SelectionGroup extends CompositeField {
}
$itemID = $this->ID() . '_' . (++$count);
+ // @todo Move into SelectionGroup_Item.ss template at some point.
$extra = array(
"RadioButton" => DBField::create_field('HTMLFragment', FormField::create_tag(
'input',
@@ -91,12 +92,16 @@ class SelectionGroup extends CompositeField {
'id' => $itemID,
'name' => $this->name,
'value' => $item->getValue(),
- 'checked' => $checked
+ 'checked' => $checked,
+ 'aria-labelledby' => "title-{$itemID}",
)
)),
"RadioLabel" => DBField::create_field('HTMLFragment', FormField::create_tag(
'label',
- array('for' => $itemID),
+ array(
+ 'id' => "title-{$itemID}",
+ 'for' => $itemID
+ ),
$item->getTitle()
)),
"Selected" => $firstSelected,
@@ -116,9 +121,7 @@ class SelectionGroup extends CompositeField {
Requirements::javascript(FRAMEWORK_DIR . '/client/dist/js/SelectionGroup.js');
Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/SelectionGroup.css');
- $obj = $properties ? $this->customise($properties) : $this;
-
- return $obj->renderWith($this->getTemplates());
+ return parent::FieldHolder($properties);
}
}
diff --git a/templates/forms/CompositeField.ss b/templates/forms/CompositeField.ss
index 1640d6eb7..2fb53afa3 100644
--- a/templates/forms/CompositeField.ss
+++ b/templates/forms/CompositeField.ss
@@ -1,15 +1,9 @@
-<$Tag class="CompositeField $extraClass <% if ColumnCount %>multicolumn<% end_if %>">
- <% if $Tag == 'fieldset' && $Legend %>
-
- <% end_if %>
-
- <% loop $FieldList %>
- <% if $ColumnCount %>
-
- $Field
-
- <% else %>
+<% loop $FieldList %>
+ <% if $ColumnCount %>
+
$Field
- <% end_if %>
- <% end_loop %>
-$Tag>
+
+ <% else %>
+ $Field
+ <% end_if %>
+<% end_loop %>
diff --git a/templates/forms/CompositeField_holder.ss b/templates/forms/CompositeField_holder.ss
index a3f0c7c5a..9cb6a0f06 100644
--- a/templates/forms/CompositeField_holder.ss
+++ b/templates/forms/CompositeField_holder.ss
@@ -1,17 +1,7 @@
-<$Tag class="CompositeField $extraClass <% if ColumnCount %>multicolumn<% end_if %>" id="$HolderID">
+<$Tag class="CompositeField $extraClass <% if $ColumnCount %>multicolumn<% end_if %>" id="$HolderID">
<% if $Tag == 'fieldset' && $Legend %>
<% end_if %>
- <% loop $FieldList %>
- <% if $ColumnCount %>
-
- $FieldHolder
-
- <% else %>
- $FieldHolder
- <% end_if %>
- <% end_loop %>
-
- <% if $Description %>$Description<% end_if %>
+ $Field
$Tag>
diff --git a/templates/forms/CompositeField_holder_small.ss b/templates/forms/CompositeField_holder_small.ss
index e06d92024..081da5b4f 100644
--- a/templates/forms/CompositeField_holder_small.ss
+++ b/templates/forms/CompositeField_holder_small.ss
@@ -1,4 +1,4 @@
-<$Tag class="CompositeField $extraClass <% if $ColumnCount %>multicolumn<% end_if %>">
+<$Tag class="CompositeField $extraClass <% if $ColumnCount %>multicolumn<% end_if %>" id="$HolderID">
<% if $Tag == 'fieldset' && $Legend %>
<% end_if %>