From aa9ad90c0038008f12cd6a0f5ffe3c8308cee396 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 17 Mar 2016 19:53:42 +0000 Subject: [PATCH] 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 --- includes/skins/Skin.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 + ); } /** -- 2.20.1