Make HTMLTagFilter disappear totally when $wgUseTagFilter = false
authorThis, that and the other <at.light@live.com.au>
Mon, 16 Feb 2015 13:02:51 +0000 (00:02 +1100)
committerThis, that and the other <at.light@live.com.au>
Mon, 16 Feb 2015 13:02:51 +0000 (00:02 +1100)
Previously the label displayed but the input field didn't.

Bug: T78432
Change-Id: Ia84ac611f76c98495a5b3f90c0ce01b6e1e404a3

includes/htmlform/HTMLTagFilter.php

index eac9423..8075de5 100644 (file)
@@ -1,14 +1,30 @@
 <?php
 /**
- * Wrapper for ChgangeTags::buildTagFilterSelector to use in HTMLForm
+ * Wrapper for ChangeTags::buildTagFilterSelector to use in HTMLForm
  */
 class HTMLTagFilter extends HTMLFormField {
+       protected $tagFilter;
+
+       function getTableRow( $value ) {
+               $this->tagFilter = ChangeTags::buildTagFilterSelector( $value );
+               if ( $this->tagFilter ) {
+                       return parent::getTableRow( $value );
+               }
+               return '';
+       }
+
+       function getDiv( $value ) {
+               $this->tagFilter = ChangeTags::buildTagFilterSelector( $value );
+               if ( $this->tagFilter ) {
+                       return parent::getDiv( $value );
+               }
+               return '';
+       }
+
        function getInputHTML( $value ) {
-               $tagFilter = ChangeTags::buildTagFilterSelector( $value );
-               if ( $tagFilter ) {
-                       list( $tagFilterLabel, $tagFilterSelector ) = $tagFilter;
+               if ( $this->tagFilter ) {
                        // we only need the select field, HTMLForm should handle the label
-                       return $tagFilterSelector;
+                       return $this->tagFilter[1];
                }
                return '';
        }