10 defined(
'JPATH_PLATFORM') or die;
29 protected $type =
'Radio';
38 protected function getInput()
43 $class = !empty($this->
class) ?
' class="radio ' . $this->
class . '"' : ' class="radio"';
44 $required = $this->required ? ' required aria-required="true"' : '';
45 $autofocus = $this->autofocus ? ' autofocus' : '';
46 $disabled = $this->disabled ? ' disabled' : '';
47 $readonly = $this->readonly;
50 $html[] = '<fieldset id="' . $this->id . '"' . $class . $required . $autofocus . $disabled . ' >';
53 $options = $this->getOptions();
56 foreach ($options as $i => $option)
59 $checked = ((string) $option->value == (
string) $this->value) ?
' checked="checked"' :
'';
60 $class = !empty($option->class) ?
' class="' . $option->class .
'"' :
'';
62 $disabled = !empty($option->disable) || ($readonly && !$checked);
64 $disabled = $disabled ?
' disabled' :
'';
67 $onclick = !empty($option->onclick) ?
' onclick="' . $option->onclick .
'"' :
'';
68 $onchange = !empty($option->onchange) ?
' onchange="' . $option->onchange .
'"' :
'';
70 $html[] =
'<input type="radio" id="' . $this->
id . $i .
'" name="' . $this->name .
'" value="'
71 . htmlspecialchars($option->value, ENT_COMPAT,
'UTF-8') .
'"' . $checked . $class . $required . $onclick
72 . $onchange . $disabled .
' />';
74 $html[] =
'<label for="' . $this->
id . $i .
'"' . $class .
' >'
75 .
JText::alt($option->text, preg_replace(
'/[^a-zA-Z0-9_\-]/',
'_', $this->fieldname)) .
'</label>';
81 $html[] =
'</fieldset>';
83 return implode($html);
93 protected function getOptions()
97 foreach ($this->element->children() as $option)
100 if ($option->getName() !=
'option')
105 $disabled = (string) $option[
'disabled'];
106 $disabled = ($disabled ==
'true' || $disabled ==
'disabled' || $disabled ==
'1');
110 'select.option', (
string) $option[
'value'], trim((
string) $option),
'value',
'text',
115 $tmp->class = (string) $option[
'class'];
118 $tmp->onclick = (string) $option[
'onclick'];
119 $tmp->onchange = (string) $option[
'onchange'];