if ( !$tag ) {
continue;
}
- $description = self::tagDescription( $tag );
+ $description = self::tagDescription( $tag, $context );
if ( $description === false ) {
continue;
}
* we consider the tag hidden, and return false.
*
* @param string $tag Tag
+ * @param IContextSource $context
* @return string|bool Tag description or false if tag is to be hidden.
* @since 1.25 Returns false if tag is to be hidden.
*/
- public static function tagDescription( $tag ) {
- $msg = wfMessage( "tag-$tag" );
+ public static function tagDescription( $tag, IContextSource $context ) {
+ $msg = $context->msg( "tag-$tag" );
if ( !$msg->exists() ) {
// No such message, so return the HTML-escaped tag name.
return htmlspecialchars( $tag );
* Build a text box to select a change tag
*
* @param string $selected Tag to select by default
- * @param bool $fullForm Affects return value, see below
- * @param Title $title Title object to send the form to. Used only if $fullForm is true.
* @param bool $ooui Use an OOUI TextInputWidget as selector instead of a non-OOUI input field
* You need to call OutputPage::enableOOUI() yourself.
- * @return string|array
- * - if $fullForm is false: an array of (label, selector).
- * - if $fullForm is true: HTML of entire form built around the selector.
+ * @return array an array of (label, selector)
*/
- public static function buildTagFilterSelector( $selected = '',
- $fullForm = false, Title $title = null, $ooui = false
- ) {
+ public static function buildTagFilterSelector( $selected = '', $ooui = false ) {
global $wgUseTagFilter;
if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) ) {
- return $fullForm ? '' : [];
+ return [];
}
$data = [
);
}
- if ( !$fullForm ) {
- return $data;
- }
-
- $html = implode( ' ', $data );
- $html .= "\n" .
- Xml::element(
- 'input',
- [ 'type' => 'submit', 'value' => wfMessage( 'tag-filter-submit' )->text() ]
- );
- $html .= "\n" . Html::hidden( 'title', $title->getPrefixedText() );
- $html = Xml::tags(
- 'form',
- [ 'action' => $title->getLocalURL(), 'class' => 'mw-tagfilter-form', 'method' => 'get' ],
- $html
- );
-
- return $html;
+ return $data;
}
/**