Manual:Hooks/ContentAlterParserOutput
Appearance
ContentAlterParserOutput | |
---|---|
Available from version 1.25.0 (Gerrit change 161471) Customize parser output for a given content object, called by ContentHandler::getParserOutput . | |
Define function: | public static function onContentAlterParserOutput( Content $content, Title $title, ParserOutput &$output ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"ContentAlterParserOutput": "MediaWiki\\Extension\\MyExtension\\Hooks::onContentAlterParserOutput"
}
}
|
Called from: | File(s): content/ContentHandler.php Function(s): getParserOutput |
Interface: | ContentAlterParserOutputHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ContentAlterParserOutput extensions.
Details
[edit]Modifies the parser output for a given content object. Since MW 1.39, called by ContentHandler::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
See also
[edit]- Manual:ContentHandler.php
- Before MW 1.39, Manual:AbstractContent.php and Manual:Content.php used to call this hook.