* @param int $flags Customisation flags (e.g. Linker::TOOL_LINKS_NOBLOCK
* and Linker::TOOL_LINKS_EMAIL).
* @param int|null $edits User edit count (optional, for performance)
+ * @param bool $useParentheses (optional) Wrap comments in parentheses where needed
* @return string HTML fragment
*/
public static function userToolLinks(
- $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits = null
+ $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits = null,
+ $useParentheses = true
) {
global $wgUser, $wgDisableAnonTalk, $wgLang;
$talkable = !( $wgDisableAnonTalk && $userId == 0 );
Hooks::run( 'UserToolLinksEdit', [ $userId, $userText, &$items ] );
if ( $items ) {
- return wfMessage( 'word-separator' )->escaped()
- . '<span class="mw-usertoollinks">'
- . wfMessage( 'parentheses' )->rawParams( $wgLang->pipeList( $items ) )->escaped()
- . '</span>';
+ if ( $useParentheses ) {
+ return wfMessage( 'word-separator' )->escaped()
+ . '<span class="mw-usertoollinks">'
+ . wfMessage( 'parentheses' )->rawParams( $wgLang->pipeList( $items ) )->escaped()
+ . '</span>';
+ } else {
+ $tools = [];
+ foreach ( $items as $tool ) {
+ $tools[] = Html::rawElement( 'span', [], $tool );
+ }
+ return ' <span class="mw-usertoollinks mw-changeslist-links">' .
+ implode( ' ', $tools ) . '</span>';
+ }
} else {
return '';
}
} else {
$s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
$rc->mAttribs['rc_user_text'] );
- $s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+ $s .= Linker::userToolLinks(
+ $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'],
+ false, 0, null,
+ // The text content of tools is not wrapped with parenthesises or "piped".
+ // This will be handled in CSS (T205581).
+ false
+ );
}
}