From 51e00a4f262efb0faf1aac1e547086f9df6eedb8 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 4 Jul 2019 22:13:18 +0100 Subject: [PATCH] installer: Fix Html::infoBox param docs and mark as internal 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 | 12 ++++++------ includes/installer/WebInstaller.php | 11 +++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/includes/Html.php b/includes/Html.php index fdc348b852..ebaff76d8a 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -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;' ], ' ' ); diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 20018d0dfb..b09455e963 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -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 ); } /** -- 2.20.1