Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Manual:Hooks/OutputPageParserOutput

From mediawiki.org
<Manual:Hooks
OutputPageParserOutput
Available from version 1.6.0
Called after parse, before the HTML is added to the output
Define function:
publicstaticfunctiononOutputPageParserOutput(OutputPage$out,ParserOutput$parserOutput){...}
Attach hook:Inextension.json:
{"Hooks":{"OutputPageParserOutput":"MediaWiki\\Extension\\MyExtension\\Hooks::onOutputPageParserOutput"}}
Called from:File(s):Output/OutputPage.php
Function(s): addParserOutputMetadata
Interface:OutputPageParserOutputHook.php

For more information about attaching hooks, seeManual:Hooks.
For examples of extensions using this hook, seeCategory:OutputPageParserOutput extensions.

Called directly after theLanguageLinks hook is provided.

Arguments

[edit]

Setting Parser properties for use by this hook

[edit]

Are you contributing to an extension and want to set a parser property that can later be used by the OutputPageParserOutput hook? TheParserOutput::setExtensionData() and::appendExtensionData() methods are available for your purpose.

For instance, if somewhere in your code, you define a property like:

$parser->getOutput()->setExtensionData('my_ext_foo','...');

In your method for this hook, you can fetch the value from the ParserOutput like this:

$parserOutput->getExtensionData('my_ext_foo');
Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:Hooks/OutputPageParserOutput&oldid=7550904"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp