From 12f36b502da6bae4c52d1fa7829821ca537970af Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Tue, 17 Mar 2015 00:56:46 +0530 Subject: [PATCH] Remove table header from Special:Tags when there are no tags The table header shows up even when there are no tags to be listed in the table. This patch fixes the same Bug: T92728 Change-Id: I22d2c0435bc365f65354cea604b1c87905c769f8 --- includes/specials/SpecialTags.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/specials/SpecialTags.php b/includes/specials/SpecialTags.php index ff263b6474..0b8147e196 100644 --- a/includes/specials/SpecialTags.php +++ b/includes/specials/SpecialTags.php @@ -114,6 +114,12 @@ class SpecialTags extends SpecialPage { $showActions = $user->isAllowed( 'managechangetags' ); // Write the headers + $tagUsageStatistics = ChangeTags::tagUsageStatistics(); + + // Show header only if there exists atleast one tag + if ( !$tagUsageStatistics ) { + return; + } $html = Xml::tags( 'tr', null, Xml::tags( 'th', null, $this->msg( 'tags-tag' )->parse() ) . Xml::tags( 'th', null, $this->msg( 'tags-display-header' )->parse() ) . Xml::tags( 'th', null, $this->msg( 'tags-description-header' )->parse() ) . @@ -134,7 +140,7 @@ class SpecialTags extends SpecialPage { $this->extensionActivatedTags = array_fill_keys( ChangeTags::listExtensionActivatedTags(), true ); - foreach ( ChangeTags::tagUsageStatistics() as $tag => $hitcount ) { + foreach ( $tagUsageStatistics as $tag => $hitcount ) { $html .= $this->doTagRow( $tag, $hitcount, $showActions ); } -- 2.20.1