Manual:Hooks/ContentGetParserOutput
ContentGetParserOutput | |
---|---|
Available from version 1.24.0 (Gerrit change 67983) Customize parser output for a given content object, called by ContentHandler::getParserOutput. May be used to override the normal model-specific rendering of page content. | |
Define function: | public static function onContentGetParserOutput( $content, $title, $revId, $options, $generateHtml, &$output ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"ContentGetParserOutput": "MediaWiki\\Extension\\MyExtension\\Hooks::onContentGetParserOutput"
}
}
|
Called from: | File(s): includes/content/ContentHandler.php |
Interface: | ContentGetParserOutputHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ContentGetParserOutput extensions.
Details
editCalled from ContentHandler::getParserOutput . Previously called from AbstractContent::getParserOutput .
Arguments
edit- $content
- The Content object to render
- $title
- A Title object for the page, as context
- $revId
- The revision ID, as context
- $options
- ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state.
- $generateHtml
- boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object.
- &$output
- ParserOutput, to manipulate or replace