element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
$attr .= $this->multiple ? ' multiple="multiple"' : '';
$attr .= $this->required ? ' required="required" aria-required="true"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
// Iterate through the children and build an array of options.
foreach ($this->element->children() as $option)
{
// Only add elements.
if ($option->getName() != 'option')
{
continue;
}
// Create a new option object based on the element.
$tmp = JHtml::_(
'select.option', (string) $option['value'], trim((string) $option), 'value', 'text',
((string) $option['disabled'] == 'true')
);
// Set some option attributes.
$tmp->class = (string) $option['class'];
// Set some JavaScript option attributes.
$tmp->onclick = (string) $option['onclick'];
// Add the option object to the result set.
$options[] = $tmp;
}
return JHtml::_('access.usergroup', $this->name, $this->value, $attr, $options, $this->id);
}
}