Manual:Hooks/DifferenceEngineNewHeader

DifferenceEngineNewHeader
Available from version 1.29.0 (Gerrit change 298026)
Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision's author, whether

the revision was marked as a minor edit or not, etc.

Define function:
public static function onDifferenceEngineNewHeader( DifferenceEngine $differenceEngine, string &$newHeader, array $formattedRevisionTools, string $nextlink, string $rollback, string $newminor, bool $diffOnly, RevisionDelete $rdel, bool $unhide ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"DifferenceEngineNewHeader": "MediaWiki\\Extension\\MyExtension\\Hooks::onDifferenceEngineNewHeader"
	}
}
Called from: File(s): diff/DifferenceEngine.php
Function(s): showDiffPage
Interface: DifferenceEngineNewHeaderHook.php

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


Details

edit
  • $differenceEngine: DifferenceEngine object
  • &$newHeader: The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more
  • $formattedRevisionTools: Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook
  • $nextlink: String containing the link to the next revision (if any); also included in $newHeader
  • $rollback: Rollback link (string) to roll this revision back to the previous one, if any
  • $newminor: String indicating if the new revision was marked as a minor edit
  • $diffOnly: Boolean parameter passed to DifferenceEngine#showDiffPage, indicating whether we should show just the diff; passed in as a query string parameter to the various URLs constructed here (i.e. $nextlink)
  • $rdel: RevisionDelete link for the new revision, if the current user is allowed to use the RevisionDelete feature
  • $unhide: Boolean parameter indicating whether to show RevisionDeleted revisions