HTMLFormField: Treat weird ' ' labels as empty in OOUI mode
authorBartosz Dziewoński <matma.rex@gmail.com>
Thu, 28 Sep 2017 12:10:31 +0000 (14:10 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Thu, 28 Sep 2017 12:13:14 +0000 (14:13 +0200)
I have no idea where this convention came from, but we had them in
core until 265ff105aaa814c828a35e599ed35d0b0bb00e53 and they still
appear widely in extensions. The non-OOUI code also has special
handling for it (a label equalling '&#160;' is treated as raw HTML
even when not marked as such). In OOUI-style "vertical" forms these
fake labels cause a lot of unnecessary white space to appear, so let's
just not display them.

Change-Id: I45559fa69dc1ae4b9d048445e27a24815fe93b6d

includes/htmlform/HTMLFormField.php

index e642c2c..9c301e6 100644 (file)
@@ -631,7 +631,7 @@ abstract class HTMLFormField {
 
                // the element could specify, that the label doesn't need to be added
                $label = $this->getLabel();
-               if ( $label ) {
+               if ( $label && $label !== '&#160;' ) {
                        $config['label'] = new OOUI\HtmlSnippet( $label );
                }