Manual:Hooks/ResourceLoaderJqueryMsgModuleMagicWords

From Linux Web Expert

ResourceLoaderJqueryMsgModuleMagicWords
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 344079)</tvar></translate>
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
<translate> Define function:</translate>
public static function onResourceLoaderJqueryMsgModuleMagicWords( ResourceLoaderContext $context, array &$magicWords ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"ResourceLoaderJqueryMsgModuleMagicWords": "MediaWiki\\Extension\\MyExtension\\Hooks::onResourceLoaderJqueryMsgModuleMagicWords"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> ../resources/Resources.php
<translate> Function(s):</translate> ResourceLoaderJqueryMsgModule::getScript
<translate> Interface:</translate> ResourceLoaderJqueryMsgModuleMagicWordsHook.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:ResourceLoaderJqueryMsgModuleMagicWords extensions</tvar>.</translate>


Details

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