Merge "Use interwiki cache directly to resolve transwiki import sources"
[lhc/web/wiklou.git] / includes / htmlform / HTMLFormField.php
index 13756e3..2e3fdb0 100644 (file)
@@ -11,7 +11,7 @@ abstract class HTMLFormField {
        protected $mFilterCallback;
        protected $mName;
        protected $mDir;
-       protected $mLabel; # String label.  Set on construction
+       protected $mLabel; # String label, as HTML. Set on construction.
        protected $mID;
        protected $mClass = '';
        protected $mVFormClass = '';
@@ -55,6 +55,15 @@ abstract class HTMLFormField {
                return false;
        }
 
+       /**
+        * True if this field type is able to display errors; false if validation errors need to be
+        * displayed in the main HTMLForm error area.
+        * @return bool
+        */
+       public function canDisplayErrors() {
+               return true;
+       }
+
        /**
         * Get a translated interface message
         *
@@ -592,7 +601,7 @@ abstract class HTMLFormField {
                $config = array(
                        'classes' => array( "mw-htmlform-field-$fieldType", $this->mClass ),
                        'align' => $this->getLabelAlignOOUI(),
-                       'label' => $this->getLabel(),
+                       'label' => new OOUI\HtmlSnippet( $this->getLabel() ),
                        'help' => $helpText !== null ? new OOUI\HtmlSnippet( $helpText ) : null,
                        'errors' => $errors,
                        'infusable' => $infusable,
@@ -828,7 +837,7 @@ abstract class HTMLFormField {
        }
 
        /**
-        * @return string
+        * @return string HTML
         */
        function getLabel() {
                return is_null( $this->mLabel ) ? '' : $this->mLabel;
@@ -916,7 +925,8 @@ abstract class HTMLFormField {
         * Returns the given attributes from the parameters
         *
         * @param array $list List of attributes to get
-        * @param array $mappings Optional - Key/value map of attribute names to use instead of the ones passed in
+        * @param array $mappings Optional - Key/value map of attribute names to use
+        *   instead of the ones passed in.
         * @return array Attributes
         */
        public function getAttributes( array $list, array $mappings = null ) {