Jump to content

Manual:Hooks/HistoryTools

From mediawiki.org
HistoryTools
Available from version 1.35.0 (Gerrit change 605670)
Use this hook to override or extend the revision tools available from the page history view, i.e. undo, rollback, etc. From 1.40 this hook also applies to other pages including Special:Contributions, Special:Recentchanges and Special:Watchlist
Define function:
public static function onHistoryTools( MediaWiki\Revision\RevisionRecord $currentRevision, array &$links, ?MediaWiki\Revision\RevisionRecord $prevRevision, MediaWiki\User\UserIdentity $userIdentity ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"HistoryTools": "MediaWiki\\Extension\\MyExtension\\Hooks::onHistoryTools"
	}
}
Called from: File(s): actions/pagers/HistoryPager.php
Function(s): historyLine
Interface: HistoryToolsHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:HistoryTools extensions.


Details

[edit]
  • $newRevision: Current revision
  • &$links: Array of string HTML links
  • $prevRevision: Previous revision (may be null)
  • $userIdentity: Current user