Open main menu

Manual:Hooks/ContentAlterParserOutput

ContentAlterParserOutput
Available from version 1.25.0 (Gerrit change 161471)
Customize parser output for a given content object, called by AbstractContent::getParserOutput.
Define function:
public static function onContentAlterParserOutput( Content $content, Title $title, ParserOutput &$output ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ContentAlterParserOutput": "MyExtensionHooks::onContentAlterParserOutput"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ContentAlterParserOutput'][] = 'MyExtensionHooks::onContentAlterParserOutput';
Called from:File(s): content/AbstractContent.php
Function(s): getParserOutput

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

DetailsEdit

Modifies the parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called (such as adding tracking categories based on the rendered HTML).

$content
The Content to render
$title
Title of the page, as context
$parserOutput
ParserOutput to manipulate