Manual:Hooks/AfterFinalPageOutput
From Linux Web Expert
AfterFinalPageOutput | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> Nearly at the end of OutputPage::output(). | |
<translate> Define function:</translate> | public static function onAfterFinalPageOutput( $output ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"AfterFinalPageOutput": "MediaWiki\\Extension\\MyExtension\\Hooks::onAfterFinalPageOutput"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> OutputPage.php |
<translate> Interface:</translate> | AfterFinalPageOutputHook.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:AfterFinalPageOutput extensions</tvar>.</translate>
Details
Nearly at the end of OutputPage::output()
but before OutputPage::sendCacheControl()
and final ob_end_flush()
which will send the buffered output to the client. This allows for last-minute modification of the output within the buffer by using ob_get_clean()
.
- $output: The OutputPage object where output() was called
How to use
$wgHooks['AfterFinalPageOutput'][] = "fnAfterAll";
function fnAfterAll($output) {
$out = ob_get_clean();
// change final html in $out
ob_start();
echo $out;
return true;
}