Manual:Hooks/ContentGetParserOutput
From Linux Web Expert
ContentGetParserOutput | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 67983)</tvar></translate> 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. | |
<translate> Define function:</translate> | public static function onContentGetParserOutput( $content, $title, $revId, $options, $generateHtml, &$output ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"ContentGetParserOutput": "MediaWiki\\Extension\\MyExtension\\Hooks::onContentGetParserOutput"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> includes/content/ContentHandler.php |
<translate> Interface:</translate> | ContentGetParserOutputHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:ContentGetParserOutput extensions</tvar>.</translate>
Details
Called from ContentHandler::getParserOutput . Previously called from AbstractContent::getParserOutput .
Arguments
- $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