Manual:Hooks/SkinTemplateOutputPageBeforeExec

Category:MediaWiki hooks#SkinTemplateOutputPageBeforeExec Category:Hooks added in MediaWiki 1.10.0#SkinTemplateOutputPageBeforeExec Category:MediaWiki deprecated or obsolete features#SkinTemplateOutputPageBeforeExec Category:Hooks removed in MediaWiki 1.37.0#SkinTemplateOutputPageBeforeExec Category:Hooks deprecated in MediaWiki 1.35.0#SkinTemplateOutputPageBeforeExec
SkinTemplateOutputPageBeforeExec
Available from version 1.10.0 (r19063, CodeReview archive)
Removed in version 1.37.0 (Gerrit change 709112)Category:Removed hooks#SkinTemplateOutputPageBeforeExec
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onSkinTemplateOutputPageBeforeExec"
	}
}
Called from: File(s): SkinTemplate.phpCategory:MediaWiki hooks included in SkinTemplate.php#SkinTemplateOutputPageBeforeExec
Interface: SkinTemplateOutputPageBeforeExecHook.php

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

Details

  • $skin: SkinTemplate
  • $template: QuickTemplate

Migration notes

Warning Warning: If you can avoid using this hook, please do. Seek more specific hooks such as Manual:Hooks/SkinAddFooterLinks wherever you can.

This hook is deprecated since 1.35 (T60137)

Developers using this hook should instead:

  • Use Manual:Hooks/SkinAddFooterLinks if adding a link to the footer
  • To pass data to a BaseTemplate skin for rendering use OutputPage->getProperty and OutputPage->setProperty alongside one of the OutputPage hooks.
  • To update user messages, use Manual:Hooks/GetNewMessagesAlert.
  • To force an empty portal to display in the sidebar use Manual:Hooks/SkinAfterPortlet and return a non-empty string
  • For extensions which depend on other skins (for example BlueSpice / Chameleon) the skin should provide its own hook. See phab:T254300 for an example.

Example

$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function ( &$skin, &$template ) {
	$template->set( 'key', 'value' );
	$someVar = 'asdf';
	$template->setRef( 'key', $someVar );
	$template->data['key'];
	return true;
};
Category:Hooks added in MediaWiki 1.10.0 Category:Hooks deprecated in MediaWiki 1.35.0 Category:Hooks removed in MediaWiki 1.37.0 Category:MediaWiki deprecated or obsolete features Category:MediaWiki hooks Category:MediaWiki hooks included in SkinTemplate.php Category:Removed hooks