/** * Adds a new OPTION to the SELECT * * @param string $text Display text for the OPTION * @param string $value Value for the OPTION * @param mixed $attributes Either a typical HTML attribute string * or an associative array * @since 1.0 * @access public * @return void */ static function addOption($text, $value, $attributes = null) { if (null === $attributes) { $attributes = array('value' => $value); } else { $attributes = self::_parseAttributes($attributes); if (isset($attributes['selected'])) { // the 'selected' attribute will be set in toHtml() self::_removeAttr('selected', $attributes); if (is_null(self::$_values)) { self::$_values = array($value); } elseif (!in_array($value, self::$_values)) { self::$_values[] = $value; } } self::_updateAttrArray($attributes, array('value' => $value)); } self::$_options[] = array('text' => $text, 'attr' => $attributes); }