Manual:Hooks/ArticleContentViewCustom

From MediaWiki.org
Jump to navigation Jump to search
ArticleContentViewCustom
Available from version 1.21.0
allows to output the text of the article in a different format than wikitext
Define function:
public static function onArticleContentViewCustom( $content, $title, $output ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ArticleContentViewCustom": "MyExtensionHooks::onArticleContentViewCustom"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ArticleContentViewCustom'][] = 'MyExtensionHooks::onArticleContentViewCustom';
Called from:File(s): page/Article.php

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

Details[edit]

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

  • $content: content of the page, as a Content object
  • $title: title of the page
  • $output: reference to $wgOut