Esempio n. 1
0
function option($value, $label = null, $options = array())
{
    global $request;
    $bindStatus =& $request->getAttribute('select_listValue');
    assert_not_null($bindStatus, 'option tag must be used within a select tag');
    $iVal = _get_display_string($value, $bindStatus->getEditor());
    $iLabel = $label == null ? $iVal : $label;
    $options['value'] = $iVal;
    if (SelectedValueComparator::isSelected($bindStatus, $iVal)) {
        $selectedVal = _tag_get_attribute('select', 'selectedVal');
        if ($selectedVal !== true) {
            $options['selected'] = 'selected';
            _tag_set_attribute('select', 'selectedVal', $val = true);
        }
    }
    return content_tag('option', $iLabel, $options);
}