HTMLFormField: Do not double-escape label in OOUI mode
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 4 Nov 2015 00:15:29 +0000 (01:15 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 4 Nov 2015 00:18:46 +0000 (01:18 +0100)
$this->getLabel() returns already parsed HTML. Who'd have thought?
https://www.wikidata.org/wiki/Wikidata:Contact_the_development_team#Display_issue_on_Special:NewItem

Change-Id: I52aa9b78fde27d4a16b3636fa6b70d3c69ff2346

includes/htmlform/HTMLFormField.php

index 20d7250..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 = '';
@@ -601,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,
@@ -837,7 +837,7 @@ abstract class HTMLFormField {
        }
 
        /**
-        * @return string
+        * @return string HTML
         */
        function getLabel() {
                return is_null( $this->mLabel ) ? '' : $this->mLabel;