♻️ rework of Select UIBlock with labels

This commit is contained in:
Eric
2021-06-04 11:52:13 +02:00
parent f4839ef88f
commit 39c1286aa6
15 changed files with 416 additions and 81 deletions

View File

@@ -186,23 +186,19 @@ EOF
$aChoices = $this->oField->GetChoices();
foreach ($aChoices as $sChoice => $sLabel)
{
if ((count($aChoices)== 1) && $bMandatory)
{
if ((count($aChoices) == 1) && $bMandatory) {
// When there is only once choice, select it by default
$sSelected = 'checked';
$value = $sChoice;
}
else
{
$value = $sChoice;
} else {
$sSelected = ($value == $sChoice) ? 'checked' : '';
}
$oRadio=InputUIBlockFactory::MakeForInputWithLabel($sLabel,"radio_".$sId, $sChoice,"{$sId}_{$idx}","radio" );;
$oRadio = InputUIBlockFactory::MakeForInputWithLabel($sLabel, "radio_".$sId, $sChoice, "{$sId}_{$idx}", "radio");;
$oRadio->GetInput()->SetIsChecked($sSelected);
$oRadio->SetBeforeInput(false);
$oRadio->GetInput()->AddCSSClass('ibo-input-checkbox');
$oValue->AddSubBlock($oRadio);
if ($bVertical)
{
if ($bVertical) {
$oValue->AddSubBlock(new Html("<br>"));
}
$idx++;