Manual:Hooks/SpecialPageExecuteBeforeHeader

From MediaWiki.org
Jump to navigation Jump to search
SpecialPageExecuteBeforeHeader
Available from version 1.6.0
Removed in version 1.14.0
called before setting the header text of the special page
Define function:
public static function onSpecialPageExecuteBeforeHeader( $specialPage, $par, $funct ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SpecialPageExecuteBeforeHeader": "MyExtensionHooks::onSpecialPageExecuteBeforeHeader"
	}
}

For MediaWiki ≤1.25:

$wgHooks['SpecialPageExecuteBeforeHeader'][] = 'MyExtensionHooks::onSpecialPageExecuteBeforeHeader';
Called from:File(s): SpecialPage.php

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

Details[edit]

  • $specialPage: SpecialPage object
  • $par: paramter passed to the special page (string)
  • $funct: function called to execute the special page

Usage[edit]

There is a note in includes/SpecialPage.php where this hook is called stating that it is broken for extensions:

# FIXME: these hooks are broken for extensions and anything else that subclasses SpecialPage. 

This is due to the fact that extensions that subclass SpecialPage implement their own execute function. Since the hooks are fired in the SpecialPage parent class execute function they don't get called in the subclass. A bug has been filed for this, but the chances of it being fixed in the short term are probably small due to this subclass/parentclass problem.