<?php
/**
- * Class to generate XML <select>.
+ * Class for generating HTML <select> elements.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
/**
- * Module of static functions for generating XML <select> elements
+ * Class for generating HTML <select> elements.
*/
class XmlSelect {
protected $options = array();
/**
* @param string $name
- * @param array $value
+ * @param string $value
*/
public function setAttribute( $name, $value ) {
$this->attributes[$name] = $value;
/**
* @param string $name
- * @return array|null
+ * @return string|null
*/
public function getAttribute( $name ) {
if ( isset( $this->attributes[$name] ) ) {
}
/**
- * @param string $name
- * @param bool $value
+ * @param string $label
+ * @param string $value If not given, assumed equal to $label
*/
- public function addOption( $name, $value = false ) {
- // Stab stab stab
- $value = $value !== false ? $value : $name;
-
- $this->options[] = array( $name => $value );
+ public function addOption( $label, $value = false ) {
+ $value = $value !== false ? $value : $label;
+ $this->options[] = array( $label => $value );
}
/**
}
/**
- * This accepts an array of form
+ * This accepts an array of form:
* label => value
* label => ( label => value, label => value )
*
* @param array $options
- * @param bool $default
+ * @param string $default
* @return string
*/
static function formatOptions( $options, $default = false ) {