Manual:Hooks/SkinTemplateOutputPageBeforeExec

From MediaWiki.org
Jump to navigation Jump to search
SkinTemplateOutputPageBeforeExec
Available from version 1.10.0 (r19063)
allows further setup of the template engine after all standard setup has been performed but before the skin has been rendered
Define function:
public static function onSkinTemplateOutputPageBeforeExec( &$skin, &$template ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SkinTemplateOutputPageBeforeExec": "MyExtensionHooks::onSkinTemplateOutputPageBeforeExec"
	}
}

For MediaWiki ≤1.25:

$wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'MyExtensionHooks::onSkinTemplateOutputPageBeforeExec';
Called from:File(s): SkinTemplate.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:SkinTemplateOutputPageBeforeExec extensions.

Example[edit]

$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function ( &$skin, &$template ) {
	$template->set( 'key', 'value' );
	$someVar = 'asdf';
	$template->setRef( 'key', $someVar );
	$template->data['key'];
	return true;
};