Manual:Hooks/ResourceLoaderGetStartupModules

From MediaWiki.org
Jump to navigation Jump to search
ResourceLoaderGetStartupModules
Available from version 1.18.0 (r84401)
Run once the startup module is being generated.
Define function:
public static function onResourceLoaderGetStartupModules( &$modules ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ResourceLoaderGetStartupModules": "MyExtensionHooks::onResourceLoaderGetStartupModules"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ResourceLoaderGetStartupModules'][] = 'MyExtensionHooks::onResourceLoaderGetStartupModules';
Called from:File(s): ResourceLoaderStartUpModule.php

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

Details[edit]

This allows you to add modules to the startup module. This hook should be used sparingly since any module added here will be loaded on all pages. This hook is useful if you want to make code available to module loader scripts.

  • &$modules Array of module names