\n") { $info = $this->_getInfo($name, $value, $attribs, $options, $listsep); extract($info); // name, id, value, attribs, options, listsep, disable // force $value to array so we can compare multiple values // to multiple options. settype($value, 'array'); // check for multiple attrib and change name if needed if (isset($attribs['multiple']) && $attribs['multiple'] == 'multiple' && substr($name, -2) != '[]') { $name .= '[]'; } // check for multiple implied by the name and set attrib if // needed if (substr($name, -2) == '[]') { $attribs['multiple'] = 'multiple'; } // now start building the XHTML. if ($disable) { // disabled. // generate a plain list of selected options. // show the label, not the value, of the option. $list = array(); foreach ($options as $opt_value => $opt_label) { if (in_array($opt_value, $value)) { // add the hidden value $opt = $this->_hidden($name, $opt_value); // add the display label $opt .= $this->view->escape($opt_label); // add to the list $list[] = $opt; } } $xhtml = implode($listsep, $list); } else { // enabled. // the surrounding select element first. $xhtml = '_htmlAttribs($attribs) . ">\n\t"; // build the list of options $list = array(); foreach ($options as $opt_value => $opt_label) { if (is_array($opt_label)) { $list[] = ''; foreach ($opt_label as $val => $lab) { $list[] = $this->_build($val, $lab, $value); } $list[] = ''; } else { $list[] = $this->_build($opt_value, $opt_label, $value); } } // add the options to the xhtml and close the select $xhtml .= implode("\n\t", $list) . "\n"; } return $xhtml; } /** * Builds the actual "; return $opt; } }