Manual:Hooks/ArticleRevisionViewCustom

From MediaWiki.org
Jump to navigation Jump to search
ArticleRevisionViewCustom
Available from version 1.32.0
allows to output the text of an article revision in a different format than wikitext
Define function:
public static function onArticleRevisionViewCustom( $revision, $title, $oldid, $output ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ArticleRevisionViewCustom": "MyExtensionHooks::onArticleRevisionViewCustom"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ArticleRevisionViewCustom'][] = 'MyExtensionHooks::onArticleRevisionViewCustom';
Called from:File(s): page/Article.php, diff/DifferenceEngine.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 RevisionStoreRecord object
  • $title: the page, as a Title object
  • $oldid - the oldid of the article
  • $output: reference to $wgOut

This hook replaces the ArticleAfterFetchContentObject hook.