* @copyright (c) 2006 - 2016 Stefan Gabos * @package Controls */ class Zebra_Form_Select extends Zebra_Form_Control { /** * Adds an _render_attributes() . '>' . $optContent . ''; } /** * Takes the options array and recursively generates options and optiongroups * * @return string Resulted HTML code * * @access private */ private function _generate(&$options, &$selected, $level = 0) { $content = ''; // character(s) used for indenting levels $indent = '  '; // iterate through the available options foreach ($options as $value => $caption) { // if option has child options if (is_array($caption)) { // create a dummy option group (for valid HTML/XHTML we are not allowed to create nested option groups // and also empty optiongroups are not allowed) // BUT because in IE7 the "disabled" attribute is not supported and in all versions of IE these // can't be styled, we will remove them from JavaScript // having a dummy option in them (the option is disabled and, from CSS, rendered invisible) $content .= ' '; // call the method recursively to generate the output for the children options $content .= $this->_generate($caption, $selected, $level + 1); // if entry is a standard option } else { // create the appropriate code $content .= ''; } } // return generated content return $content; } } ?>