Manual:Hooks/DiffTools

From mediawiki.org
Jump to navigation Jump to search
DiffTools
Available from version 1.35.0 (Gerrit change 605670)
Use this hook to override or extend the revision tools available from the diff view, i.e. undo, etc.
Define function:
public static function onDiffTools( MediaWiki\Revision\RevisionRecord $newRevision, array &$links, ?MediaWiki\Revision\RevisionRecord $prevRevision, MediaWiki\User\UserIdentity $userIdentity ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"DiffTools": "MyExtensionHooks::onDiffTools"
	}
}
Called from:File(s): diff/DifferenceEngine.php
Function(s): showDiffPage
Interface:DiffToolsHook.php

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

Details[edit]

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