Manual:Hooks/HistoryTools

From Linux Web Expert

Revision as of 21:40, 17 December 2022 by imported>Jdlrobson
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

HistoryTools
<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 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
<translate> Define function:</translate>
public static function onHistoryTools( MediaWiki\Revision\RevisionRecord $currentRevision, array &$links, ?MediaWiki\Revision\RevisionRecord $prevRevision, MediaWiki\User\UserIdentity $userIdentity ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"HistoryTools": "MediaWiki\\Extension\\MyExtension\\Hooks::onHistoryTools"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> actions/pagers/HistoryPager.php
<translate> Function(s):</translate> historyLine
<translate> Interface:</translate> HistoryToolsHook.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:HistoryTools extensions</tvar>.</translate>


Details

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