10 defined(
'JPATH_PLATFORM') or die;
28 protected $type =
'List';
38 protected function getInput()
44 $attr .= !empty($this->
class) ?
' class="' . $this->
class . '"' : '';
45 $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
46 $attr .= $this->multiple ? ' multiple' : '';
47 $attr .= $this->required ? ' required aria-required="true"' : '';
48 $attr .= $this->autofocus ? ' autofocus' : '';
51 if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1'|| (string) $this->disabled == 'true')
53 $attr .=
' disabled="disabled"';
57 $attr .= $this->onchange ?
' onchange="' . $this->onchange .
'"' :
'';
60 $options = (array) $this->getOptions();
63 if ((
string) $this->readonly ==
'1' || (string) $this->readonly ==
'true')
65 $html[] = JHtml::_(
'select.genericlist', $options,
'', trim($attr),
'value',
'text', $this->value, $this->
id);
66 $html[] =
'<input type="hidden" name="' . $this->name .
'" value="' . $this->value .
'"/>';
71 $html[] = JHtml::_(
'select.genericlist', $options, $this->name, trim($attr),
'value',
'text', $this->value, $this->
id);
74 return implode($html);
84 protected function getOptions()
88 foreach ($this->element->children() as $option)
91 if ($option->getName() !=
'option')
97 if ($requires = explode(
',', (
string) $option[
'requires']))
100 if (in_array(
'multilanguage', $requires) && !JLanguageMultilang::isEnabled())
106 if (in_array(
'associations', $requires) && !JLanguageAssociations::isEnabled())
112 $value = (string) $option[
'value'];
114 $disabled = (string) $option[
'disabled'];
115 $disabled = ($disabled ==
'true' || $disabled ==
'disabled' || $disabled ==
'1');
117 $disabled = $disabled || ($this->readonly && $value != $this->value);
121 'select.option', $value,
122 JText::alt(trim((
string) $option), preg_replace(
'/[^a-zA-Z0-9_\-]/',
'_', $this->fieldname)),
'value',
'text',
127 $tmp->class = (string) $option[
'class'];
130 $tmp->onclick = (string) $option[
'onclick'];