installer: Fix Html::infoBox param docs and mark as internal
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 4 Jul 2019 21:13:18 +0000 (22:13 +0100)
committerKrinkle <krinklemail@gmail.com>
Fri, 5 Jul 2019 18:26:18 +0000 (18:26 +0000)
This method is very specific to the installer and is only used in one
place, in WebInstaller, and should probably be moved there.

For now, make its documentation less confusing, more correct, and
mark it as `@internal`, this is not a supported public interface.

Bug: T227297
Change-Id: I8902fe34b80c5152bfd37e9c24427ad48b5f4167

includes/Html.php
includes/installer/WebInstaller.php

index fdc348b..ebaff76 100644 (file)
@@ -1006,16 +1006,16 @@ class Html {
        }
 
        /**
-        * Get HTML for an info box with an icon.
+        * Get HTML for an information message box with an icon.
         *
-        * @param string $text Wikitext, get this with wfMessage()->plain()
+        * @internal For use by the WebInstaller class.
+        * @param string $rawHtml HTML
         * @param string $icon Path to icon file (used as 'src' attribute)
         * @param string $alt Alternate text for the icon
         * @param string $class Additional class name to add to the wrapper div
-        *
-        * @return string
+        * @return string HTML
         */
-       static function infoBox( $text, $icon, $alt, $class = '' ) {
+       public static function infoBox( $rawHtml, $icon, $alt, $class = '' ) {
                $s = self::openElement( 'div', [ 'class' => "mw-infobox $class" ] );
 
                $s .= self::openElement( 'div', [ 'class' => 'mw-infobox-left' ] ) .
@@ -1028,7 +1028,7 @@ class Html {
                                self::closeElement( 'div' );
 
                $s .= self::openElement( 'div', [ 'class' => 'mw-infobox-right' ] ) .
-                               $text .
+                               $rawHtml .
                                self::closeElement( 'div' );
                $s .= self::element( 'div', [ 'style' => 'clear: left;' ], ' ' );
 
index 20018d0..b09455e 100644 (file)
@@ -658,22 +658,21 @@ class WebInstaller extends Installer {
        }
 
        /**
-        * Get HTML for an info box with an icon.
+        * Get HTML for an information message box with an icon.
         *
-        * @param string $text Wikitext, get this with wfMessage()->plain()
+        * @param string $text Wikitext to be parsed (from Message::plain).
         * @param string|bool $icon Icon name, file in mw-config/images. Default: false
         * @param string|bool $class Additional class name to add to the wrapper div. Default: false.
-        *
-        * @return string
+        * @return string HTML
         */
        public function getInfoBox( $text, $icon = false, $class = false ) {
-               $text = $this->parse( $text, true );
+               $html = $this->parse( $text, true );
                $icon = ( $icon == false ) ?
                        'images/info-32.png' :
                        'images/' . $icon;
                $alt = wfMessage( 'config-information' )->text();
 
-               return Html::infoBox( $text, $icon, $alt, $class );
+               return Html::infoBox( $html, $icon, $alt, $class );
        }
 
        /**