Manual:Hooks/ResourceLoaderJqueryMsgModuleMagicWords

From MediaWiki.org
Jump to navigation Jump to search
ResourceLoaderJqueryMsgModuleMagicWords
Available from version 1.29.0 (Gerrit change 344079)
Called in ResourceLoaderJqueryMsgModule to allow adding magic words for jQueryMsg. The key is an all-caps magic word, and the value is a string; values depend only on the ResourceLoaderContext
Define function:
public static function onResourceLoaderJqueryMsgModuleMagicWords( ResourceLoaderContext $context, array &$magicWords ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ResourceLoaderJqueryMsgModuleMagicWords": "MyExtensionHooks::onResourceLoaderJqueryMsgModuleMagicWords"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ResourceLoaderJqueryMsgModuleMagicWords'][] = 'MyExtensionHooks::onResourceLoaderJqueryMsgModuleMagicWords';
Called from:File(s): ../resources/Resources.php
Function(s): ResourceLoaderJqueryMsgModule::getScript

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

Details[edit]

  • $context: ResourceLoaderContext object
  • &$magicWords: Array of magic words to add to, mapping all-caps magic words to string values based on the context