Manual:Hooks/ArticleRevisionViewCustom
Appearance
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 aMediaWiki\Revision\RevisionRecord
object (ornull
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 aTitle
object$oldId
: the requested revision ID, or0
for the current revision$output
: An instance ofOutputPage
This hook replaces the ArticleAfterFetchContentObject hook.