Make mediawiki.special.pageLanguage work again
[lhc/web/wiklou.git] / includes / XmlSelect.php
index 78f4764..9d37b95 100644 (file)
  */
 
 /**
- * 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 ) {
@@ -49,6 +50,13 @@ class XmlSelect {
                $this->default = $default;
        }
 
+       /**
+        * @param string|array $tagName
+        */
+       public function setTagName( $tagName ) {
+               $this->tagName = $tagName;
+       }
+
        /**
         * @param string $name
         * @param string $value
@@ -127,6 +135,6 @@ class XmlSelect {
                        $contents .= self::formatOptions( $options, $this->default );
                }
 
-               return Html::rawElement( 'select', $this->attributes, rtrim( $contents ) );
+               return Html::rawElement( $this->tagName, $this->attributes, rtrim( $contents ) );
        }
 }