| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Content\Hook; |
| 4 | |
| 5 | use MediaWiki\Content\Content; |
| 6 | use MediaWiki\Parser\ParserOptions; |
| 7 | use MediaWiki\Parser\ParserOutput; |
| 8 | use MediaWiki\Title\Title; |
| 9 | |
| 10 | /** |
| 11 | * This is a hook handler interface, see docs/Hooks.md. |
| 12 | * Use the hook name "ContentGetParserOutput" to register handlers implementing this interface. |
| 13 | * |
| 14 | * @stable to implement |
| 15 | * @ingroup Hooks |
| 16 | */ |
| 17 | interface ContentGetParserOutputHook { |
| 18 | /** |
| 19 | * Use this hook to customize parser output for a given content object. This hook is |
| 20 | * called by AbstractContent::getParserOutput. May be used to override the normal |
| 21 | * model-specific rendering of page content. |
| 22 | * |
| 23 | * @since 1.35 |
| 24 | * |
| 25 | * @param Content $content Content to render |
| 26 | * @param Title $title Title of the page, as context |
| 27 | * @param int $revId Revision ID, as context |
| 28 | * @param ParserOptions $options ParserOptions for rendering. To avoid confusing the parser cache, |
| 29 | * the output can only depend on parameters provided to this hook function, not on global state. |
| 30 | * @param bool $generateHtml Whether full HTML should be generated. If false, generation of HTML |
| 31 | * may be skipped, but other information should still be present in the ParserOutput object. |
| 32 | * @param ParserOutput &$parserOutput ParserOutput to manipulate or replace |
| 33 | * @return bool|void True or no return value to continue or false to abort |
| 34 | */ |
| 35 | public function onContentGetParserOutput( $content, $title, $revId, $options, |
| 36 | $generateHtml, &$parserOutput |
| 37 | ); |
| 38 | } |