Manual:Hooks/DiffTools

From Linux Web Expert

DiffTools
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 605670)</tvar></translate>
Use this hook to override or extend the revision tools available from the diff view, i.e. undo, etc.
<translate> Define function:</translate>
public static function onDiffTools( MediaWiki\Revision\RevisionRecord $newRevision, array &$links, ?MediaWiki\Revision\RevisionRecord $prevRevision, MediaWiki\User\UserIdentity $userIdentity ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"DiffTools": "MediaWiki\\Extension\\MyExtension\\Hooks::onDiffTools"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> diff/DifferenceEngine.php
<translate> Function(s):</translate> showDiffPage
<translate> Interface:</translate> DiffToolsHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:DiffTools extensions</tvar>.</translate>


Details

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