From: Timo Tijhof Date: Thu, 17 Mar 2016 19:53:42 +0000 (+0000) Subject: skins: Minor doc and code clean up in getCategories() X-Git-Tag: 1.31.0-rc.0~7575^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=aa9ad90c0038008f12cd6a0f5ffe3c8308cee396;p=lhc%2Fweb%2Fwiklou.git skins: Minor doc and code clean up in getCategories() * Clarify @return as being a string of HTML. * Use Html class instead of inline string concatenation. Change-Id: If3ff352aca897c3952b1f4d6c1b9416f9db35ae6 --- diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index b80788b86c..3cc1d8f98e 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -451,7 +451,7 @@ abstract class Skin extends ContextSource { } /** - * @return string + * @return string HTML */ function getCategoryLinks() { global $wgUseCategoryBrowser; @@ -542,25 +542,27 @@ abstract class Skin extends ContextSource { } /** - * @return string + * @return string HTML */ function getCategories() { $out = $this->getOutput(); - $catlinks = $this->getCategoryLinks(); - $classes = 'catlinks'; - // Check what we're showing $allCats = $out->getCategoryLinks(); $showHidden = $this->getUser()->getBoolOption( 'showhiddencats' ) || $this->getTitle()->getNamespace() == NS_CATEGORY; + $classes = [ 'catlinks' ]; if ( empty( $allCats['normal'] ) && !( !empty( $allCats['hidden'] ) && $showHidden ) ) { - $classes .= ' catlinks-allhidden'; + $classes[] = 'catlinks-allhidden'; } - return ""; + return Html::rawElement( + 'div', + [ 'id' => 'catlinks', 'class' => $classes, 'data-mw' => 'interface' ], + $catlinks + ); } /**