Manual:Hooks/ArticleRevisionViewCustom

Category:MediaWiki hooks#ArticleRevisionViewCustom Category:Hooks added in MediaWiki 1.32.0#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.phpCategory:MediaWiki hooks included in Article.php#ArticleRevisionViewCustom, includes/diff/DifferenceEngine.phpCategory:MediaWiki hooks included in DifferenceEngine.php#ArticleRevisionViewCustom
Interface: ArticleRevisionViewCustomHook.php

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

Details

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.

Category:Hooks added in MediaWiki 1.32.0 Category:MediaWiki hooks Category:MediaWiki hooks included in Article.php Category:MediaWiki hooks included in DifferenceEngine.php