Wrap selection group input in label

This commit is contained in:
Saophalkun Ponlu 2017-04-26 13:54:06 +12:00
parent 5a7c6d4f60
commit 68041f4265
2 changed files with 2 additions and 10 deletions

View File

@ -101,17 +101,9 @@ class SelectionGroup extends CompositeField
'name' => $this->name, 'name' => $this->name,
'value' => $item->getValue(), 'value' => $item->getValue(),
'checked' => $checked, 'checked' => $checked,
'aria-labelledby' => "title-{$itemID}",
) )
)), )),
"RadioLabel" => DBField::create_field('HTMLFragment', FormField::create_tag( "RadioLabel" => $item->getTitle(),
'label',
array(
'id' => "title-{$itemID}",
'for' => $itemID
),
$item->getTitle()
)),
"Selected" => $firstSelected, "Selected" => $firstSelected,
); );
$newItems[] = $item->customise($extra); $newItems[] = $item->customise($extra);

View File

@ -13,7 +13,7 @@
<ul class="SelectionGroup<% if extraClass %> $extraClass<% end_if %>"> <ul class="SelectionGroup<% if extraClass %> $extraClass<% end_if %>">
<% loop $FieldSet %> <% loop $FieldSet %>
<li$Selected> <li$Selected>
{$RadioButton}{$RadioLabel} <label>{$RadioButton} {$RadioLabel}</label>
<% if $FieldList %> <% if $FieldList %>
$FieldHolder $FieldHolder
<% end_if %> <% end_if %>