Manual:Hooks/SkinTemplateOutputPageBeforeExec
From Linux Web Expert
File:OOjs UI icon alert-destructive.svg | <translate> This feature was removed completely in version <tvar name=ver>1.37.0</tvar> (after being deprecated in <tvar name=4>1.35.0</tvar>).</translate> |
SkinTemplateOutputPageBeforeExec | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar (r19063, codereview)</tvar></translate> <translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 709112)</tvar></translate> allows further setup of the template engine after all standard setup has been performed but before the skin has been rendered | |
<translate> Define function:</translate> | public static function onSkinTemplateOutputPageBeforeExec( &$skin, &$template ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"SkinTemplateOutputPageBeforeExec": "MediaWiki\\Extension\\MyExtension\\Hooks::onSkinTemplateOutputPageBeforeExec"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> SkinTemplate.php |
<translate> Interface:</translate> | SkinTemplateOutputPageBeforeExecHook.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:SkinTemplateOutputPageBeforeExec extensions</tvar>.</translate>
Details
- $skin: SkinTemplate
- $template: QuickTemplate
Migration notes
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;
};