Manual:Hooks/ArticleRevisionViewCustom

ArticleRevisionViewCustom
Available from version 1.32.0 (Gerrit change 452708)
allows to output the text of an article revision in a different format than wikitext
Define function:
public static function onArticleRevisionViewCustom( 
    MediaWiki\Revision\RevisionRecord $revision,
    MediaWiki\Title\Title $title, 
    int $oldId,
    MediaWiki\Output\OutputPage $output
 ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ArticleRevisionViewCustom": "MediaWiki\\Extension\\MyExtension\\Hooks::onArticleRevisionViewCustom"
	}
}
Called from: File(s): includes/page/Article.php, includes/diff/DifferenceEngine.php
Interface: ArticleRevisionViewCustomHook.php

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


Details

edit

Allows to output the text of the article revision in a different format than wikitext. Note that it is preferable to implement proper handing for a custom data type using the ContentHandler facility.

  • $revision: revision of the page, as a MediaWiki\Revision\RevisionRecord object (or null if the revision could not be loaded). This may also be a fake revision that wraps content supplied by an extension.
  • $title: the page, as a Title object
  • $oldId: the requested revision ID, or 0 for the current revision
  • $output: An instance of OutputPage

This hook replaces the ArticleAfterFetchContentObject hook.