*/
/**
- * Class for generating HTML <select> elements.
+ * Class for generating HTML <select> or <datalist> elements.
*/
class XmlSelect {
protected $options = array();
protected $default = false;
+ protected $tagName = 'select';
protected $attributes = array();
public function __construct( $name = false, $id = false, $default = false ) {
$this->default = $default;
}
+ /**
+ * @param string|array $tagName
+ */
+ public function setTagName( $tagName ) {
+ $this->tagName = $tagName;
+ }
+
/**
* @param string $name
* @param string $value
$contents .= self::formatOptions( $options, $this->default );
}
- return Html::rawElement( 'select', $this->attributes, rtrim( $contents ) );
+ return Html::rawElement( $this->tagName, $this->attributes, rtrim( $contents ) );
}
}