HTMLFormField: Don't display empty popup in OOUI mode if empty 'help' is given
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 10 Aug 2016 19:40:40 +0000 (21:40 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 24 Aug 2016 15:24:39 +0000 (15:24 +0000)
Change-Id: I1aa68dcb9cdf1584f65436a641b119f0d61537ef

includes/htmlform/HTMLFormField.php

index 8f42ea2..d48e407 100644 (file)
@@ -606,7 +606,7 @@ abstract class HTMLFormField {
                }
 
                $fieldType = get_class( $this );
-               $helpText = $this->getHelpText();
+               $help = $this->getHelpText();
                $errors = $this->getErrorsRaw( $value );
                foreach ( $errors as &$error ) {
                        $error = new OOUI\HtmlSnippet( $error );
@@ -620,7 +620,7 @@ abstract class HTMLFormField {
                $config = [
                        'classes' => [ "mw-htmlform-field-$fieldType", $this->mClass ],
                        'align' => $this->getLabelAlignOOUI(),
-                       'help' => $helpText !== null ? new OOUI\HtmlSnippet( $helpText ) : null,
+                       'help' => ( $help !== null && $help !== '' ) ? new OOUI\HtmlSnippet( $help ) : null,
                        'errors' => $errors,
                        'notices' => $notices,
                        'infusable' => $infusable,