r82406 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82405‎ | r82406 | r82407 >
Date:16:03, 18 February 2011
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
* Added a third parameter to ChangeTags::buildTagFilterSelector() to pass the Title object instead of using $wgTitle, only used when the second parameter is true (no such call both in core and extensions)
* Expanded documentation
Modified paths:
  • /trunk/phase3/includes/ChangeTags.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ChangeTags.php
@@ -147,17 +147,24 @@
148148 }
149149
150150 /**
151 - * If $fullForm is set to false, then it returns an array of (label, form).
152 - * If $fullForm is true, it returns an entire form.
 151+ * Build a text box to select a change tag
 152+ *
 153+ * @param $selected String: tag to select by default
 154+ * @param $fullForm Boolean:
 155+ * - if false, then it returns an array of (label, form).
 156+ * - if true, it returns an entire form around the selector.
 157+ * @param $title Title object to send the form to.
 158+ * Used when, and only when $fullForm is true.
 159+ * @return String or array:
 160+ * - if $fullForm is false: Array with
 161+ * - if $fullForm is true: String, html fragment
153162 */
154 - static function buildTagFilterSelector( $selected='', $fullForm = false /* used to put a full form around the selector */ ) {
 163+ public static function buildTagFilterSelector( $selected='', $fullForm = false, Title $title = null ) {
155164 global $wgUseTagFilter;
156165
157166 if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) )
158167 return $fullForm ? '' : array();
159168
160 - global $wgTitle;
161 -
162169 $data = array( wfMsgExt( 'tag-filter', 'parseinline' ), Xml::input( 'tagfilter', 20, $selected ) );
163170
164171 if ( !$fullForm ) {
@@ -166,8 +173,8 @@
167174
168175 $html = implode( ' ', $data );
169176 $html .= "\n" . Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsg( 'tag-filter-submit' ) ) );
170 - $html .= "\n" . Html::hidden( 'title', $wgTitle-> getPrefixedText() );
171 - $html = Xml::tags( 'form', array( 'action' => $wgTitle->getLocalURL(), 'method' => 'get' ), $html );
 177+ $html .= "\n" . Html::hidden( 'title', $title-> getPrefixedText() );
 178+ $html = Xml::tags( 'form', array( 'action' => $title->getLocalURL(), 'method' => 'get' ), $html );
172179
173180 return $html;
174181 }

Comments

#Comment by Hashar (talk | contribs)   22:28, 22 March 2011

I have fixed the space in $title-> getPrefixedText()

#Comment by Hashar (talk | contribs)   22:30, 22 March 2011

Was introduced by r75722 . I have marked it fixme.

#Comment by Aaron Schulz (talk | contribs)   17:07, 15 June 2011

Why not combine the $fullForm param into $title?

Status & tagging log