mediawiki-extensions-Nuke/Nuke.hooks.php
Matěj Suchánek 444d8de418 Replace Linker::link() with LinkRenderer
This updates the hook handler in order to not rely on global state.

This also raises MediaWiki version requirement to 1.28.1 and bumps the
version number to 1.3.0.

Bug: T149346
Change-Id: I9b1d877046c4cb6548bd8f40306ff7905b766f14
2017-03-01 11:56:07 -08:00

26 lines
666 B
PHP

<?php
class NukeHooks {
/**
* Shows link to Special:Nuke on Special:Contributions/username if applicable
*
* @param int $userId
* @param Title $userPageTitle
* @param string[] $toolLinks
* @param SpecialPage $sp
*/
public static function nukeContributionsLinks( $userId, $userPageTitle, &$toolLinks,
SpecialPage $sp
) {
if ( $sp->getUser()->isAllowed( 'nuke' ) ) {
$toolLinks['nuke'] = $sp->getLinkRenderer()->makeKnownLink(
SpecialPage::getTitleFor( 'Nuke' ),
$sp->msg( 'nuke-linkoncontribs' )->text(),
[ 'title' => $sp->msg( 'nuke-linkoncontribs-text' )->text() ],
[ 'target' => $userPageTitle->getText() ]
);
}
}
}