mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #6841 from open-sausages/pulls/4.0/5706-selection-group-label-wrap-input
Wrap selection group input in label
This commit is contained in:
commit
05ac2c6fc9
@ -101,17 +101,9 @@ class SelectionGroup extends CompositeField
|
||||
'name' => $this->name,
|
||||
'value' => $item->getValue(),
|
||||
'checked' => $checked,
|
||||
'aria-labelledby' => "title-{$itemID}",
|
||||
)
|
||||
)),
|
||||
"RadioLabel" => DBField::create_field('HTMLFragment', FormField::create_tag(
|
||||
'label',
|
||||
array(
|
||||
'id' => "title-{$itemID}",
|
||||
'for' => $itemID
|
||||
),
|
||||
$item->getTitle()
|
||||
)),
|
||||
"RadioLabel" => $item->getTitle(),
|
||||
"Selected" => $firstSelected,
|
||||
);
|
||||
$newItems[] = $item->customise($extra);
|
||||
|
@ -13,7 +13,7 @@
|
||||
<ul class="SelectionGroup<% if extraClass %> $extraClass<% end_if %>">
|
||||
<% loop $FieldSet %>
|
||||
<li$Selected>
|
||||
{$RadioButton}{$RadioLabel}
|
||||
<label>{$RadioButton} {$RadioLabel}</label>
|
||||
<% if $FieldList %>
|
||||
$FieldHolder
|
||||
<% end_if %>
|
||||
|
@ -31,8 +31,8 @@ class SelectionGroupTest extends SapphireTest
|
||||
$listElOne = $listEls[0];
|
||||
$listElTwo = $listEls[1];
|
||||
|
||||
$this->assertEquals('one', (string)$listElOne->input[0]['value']);
|
||||
$this->assertEquals('two', (string)$listElTwo->input[0]['value']);
|
||||
$this->assertEquals('one', (string)$listElOne->label[0]->input[0]['value']);
|
||||
$this->assertEquals('two', (string)$listElTwo->label[0]->input[0]['value']);
|
||||
|
||||
$this->assertEquals(' one title', (string)$listElOne->label[0]);
|
||||
$this->assertEquals(' two title', (string)$listElTwo->label[0]);
|
||||
@ -53,8 +53,8 @@ class SelectionGroupTest extends SapphireTest
|
||||
$listElOne = $listEls[0];
|
||||
$listElTwo = $listEls[1];
|
||||
|
||||
$this->assertEquals('one', (string)$listElOne->input[0]['value']);
|
||||
$this->assertEquals('two', (string)$listElTwo->input[0]['value']);
|
||||
$this->assertEquals('one', (string)$listElOne->label[0]->input[0]['value']);
|
||||
$this->assertEquals('two', (string)$listElTwo->label[0]->input[0]['value']);
|
||||
|
||||
$this->assertEquals(' one', (string)$listElOne->label[0]);
|
||||
$this->assertEquals(' two', (string)$listElTwo->label[0]);
|
||||
@ -72,8 +72,8 @@ class SelectionGroupTest extends SapphireTest
|
||||
$listElOne = $listEls[0];
|
||||
$listElTwo = $listEls[1];
|
||||
|
||||
$this->assertEquals('one', (string)$listElOne->input[0]['value']);
|
||||
$this->assertEquals('two', (string)$listElTwo->input[0]['value']);
|
||||
$this->assertEquals('one', (string)$listElOne->label[0]->input[0]['value']);
|
||||
$this->assertEquals('two', (string)$listElTwo->label[0]->input[0]['value']);
|
||||
|
||||
$this->assertEquals(' one title', (string)$listElOne->label[0]);
|
||||
$this->assertEquals(' two title', (string)$listElTwo->label[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user