Remove table header from Special:Tags when there are no tags
authorTina Johnson <tinajohnson.1234@gmail.com>
Mon, 16 Mar 2015 19:26:46 +0000 (00:56 +0530)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 20 Mar 2015 15:54:52 +0000 (15:54 +0000)
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

index ff263b6..0b8147e 100644 (file)
@@ -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 );
                }