Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
// Set the id to the fieldset
spanFirst.id = this.id;
// Remove the id from the custom Element
this.removeAttribute('id');
// this.removeAttribute('id');

const switchEl = document.createElement('span');
switchEl.classList.add('switch');
Expand Down
1 change: 0 additions & 1 deletion layouts/joomla/form/field/radio/switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
}

?>
<label id="<?php echo $id; ?>-lbl"><?php echo $label; ?></label>
<joomla-field-switcher <?php echo implode(' ', $attribs); ?>>
<?php foreach ($options as $i => $option) : ?>
<?php
Expand Down
7 changes: 6 additions & 1 deletion layouts/joomla/form/renderlabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

$id = $for . '-lbl';
$title = '';
$forAttr = '';

if (!empty($description))
{
Expand Down Expand Up @@ -56,7 +57,11 @@
$classes[] = 'required';
}

if(!isset($displayData['field']->skipLabelFor) || $displayData['field']->skipLabelFor !== true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilsonge @mbabker is this ok for you? We need to control when the for attribute is displayed and this was my take here

{
$forAttr = 'for="' . $for . '"';
}
?>
<label id="<?php echo $id; ?>" for="<?php echo $for; ?>"<?php if (!empty($classes)) echo ' class="' . implode(' ', $classes) . '"'; ?><?php echo $title; ?><?php echo $position; ?>>
<label id="<?php echo $id; ?>" <?php echo $forAttr; ?><?php if (!empty($classes)) echo ' class="' . implode(' ', $classes) . '"'; ?><?php echo $title; ?><?php echo $position; ?>>
<?php echo $text; ?><?php if ($required) : ?><span class="star" aria-hidden="true">&#160;*</span><?php endif; ?>
</label>
2 changes: 1 addition & 1 deletion libraries/src/Form/Field/RadioField.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
if (!$element['layout'] && strpos(trim($this->class), 'switcher') === 0)
{

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove blank line

$this->renderLabelLayout = '';
$this->skipLabelFor = true;
$this->layout = 'joomla.form.field.radio.switcher';
}

Expand Down