MediaWiki master
|
Inherits MediaWiki\ResourceLoader\Hook\ResourceLoaderExcludeUserOptionsHook, MediaWiki\ResourceLoader\Hook\ResourceLoaderForeignApiModulesHook, MediaWiki\ResourceLoader\Hook\ResourceLoaderRegisterModulesHook, MediaWiki\ResourceLoader\Hook\ResourceLoaderSiteModulePagesHook, MediaWiki\ResourceLoader\Hook\ResourceLoaderSiteStylesModulePagesHook, MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook, and MediaWiki\ResourceLoader\Hook\ResourceLoaderJqueryMsgModuleMagicWordsHook.
Public Member Functions | |
__construct (HookContainer $container) | |
onResourceLoaderExcludeUserOptions (array &$keysToExclude, Context $context) | |
Exclude a user option from the preloaded data for client-side mw.user.options. | |
onResourceLoaderForeignApiModules (&$dependencies, $context) | |
Add dependencies to the mediawiki.ForeignApi module when you wish to override its behavior. | |
onResourceLoaderGetConfigVars (array &$vars, $skin, Config $config) | |
Export static site-wide mw.config variables to JavaScript. | |
onResourceLoaderJqueryMsgModuleMagicWords (Context $context, array &$magicWords) | |
Add magic words to the mediawiki.jqueryMsg module. | |
onResourceLoaderRegisterModules (ResourceLoader $rl) | |
This hook is called right before modules information is required, such as when responding to a resource loader request or generating HTML output. | |
onResourceLoaderSiteModulePages ( $skin, array &$pages) | |
Change which wiki pages comprise the site module in given skin. | |
onResourceLoaderSiteStylesModulePages ( $skin, array &$pages) | |
Change which wiki pages comprise the site.styles module in given skin. | |
Definition at line 13 of file HookRunner.php.
MediaWiki\ResourceLoader\HookRunner::__construct | ( | HookContainer | $container | ) |
Definition at line 25 of file HookRunner.php.
MediaWiki\ResourceLoader\HookRunner::onResourceLoaderExcludeUserOptions | ( | array & | $keysToExclude, |
Context | $context | ||
) |
Exclude a user option from the preloaded data for client-side mw.user.options.
This hook is called on every index.php pageview (via ResourceLoaderUserOptionsModule), and when building responses for the "mediawiki.base" module. Avoid database queries or other expensive operations as that would increase page load time.
Use this hook to optimize pageview HTML size by omitting user preference values from the export JavaScript data for mw.user.options
. For example, when an extension stores large values in a user preference, and rarely or never needs these client-side, you can exclude it via this hook. (T251994)
This will exclude both the default value (via mediawiki.base module) and the current user's value (via pageview HTML).
array | &$keysToExclude | |
Context | $context |
Implements MediaWiki\ResourceLoader\Hook\ResourceLoaderExcludeUserOptionsHook.
Definition at line 29 of file HookRunner.php.
MediaWiki\ResourceLoader\HookRunner::onResourceLoaderForeignApiModules | ( | & | $dependencies, |
$context | |||
) |
Add dependencies to the mediawiki.ForeignApi
module when you wish to override its behavior.
See the JS docs for more information.
This hook is called from ResourceLoaderForeignApiModule.
string[] | &$dependencies | List of modules that mediawiki.ForeignApi should depend on |
Context | null | $context |
Implements MediaWiki\ResourceLoader\Hook\ResourceLoaderForeignApiModulesHook.
Definition at line 37 of file HookRunner.php.
MediaWiki\ResourceLoader\HookRunner::onResourceLoaderGetConfigVars | ( | array & | $vars, |
$skin, | |||
Config | $config | ||
) |
Export static site-wide mw.config
variables to JavaScript.
Variables that depend on the current page or request state must be added through MediaWiki\Hook\MakeGlobalVariablesScriptHook instead. The skin name is made available to send skin-specific config only when needed.
This hook is called from ResourceLoaderStartUpModule.
array | &$vars | [ variable name => value ] |
string | $skin | |
Config | $config | since 1.34 |
Implements MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook.
Definition at line 69 of file HookRunner.php.
MediaWiki\ResourceLoader\HookRunner::onResourceLoaderJqueryMsgModuleMagicWords | ( | Context | $context, |
array & | $magicWords | ||
) |
Add magic words to the mediawiki.jqueryMsg
module.
The values should be a string, and they may only vary by what's in the Context.
This hook is called from ResourceLoaderJqueryMsgModule.
Context | $context | |
string[] | &$magicWords | Associative array mapping all-caps magic word to a string value |
Implements MediaWiki\ResourceLoader\Hook\ResourceLoaderJqueryMsgModuleMagicWordsHook.
Definition at line 77 of file HookRunner.php.
MediaWiki\ResourceLoader\HookRunner::onResourceLoaderRegisterModules | ( | ResourceLoader | $rl | ) |
This hook is called right before modules information is required, such as when responding to a resource loader request or generating HTML output.
ResourceLoader | $rl |
Implements MediaWiki\ResourceLoader\Hook\ResourceLoaderRegisterModulesHook.
Definition at line 45 of file HookRunner.php.
MediaWiki\ResourceLoader\HookRunner::onResourceLoaderSiteModulePages | ( | $skin, | |
array & | $pages | ||
) |
Change which wiki pages comprise the site
module in given skin.
This hook is called from MediaWiki\ResourceLoader\SiteModule.
string | $skin | Current skin key |
array | &$pages | Array of pages and their types |
Implements MediaWiki\ResourceLoader\Hook\ResourceLoaderSiteModulePagesHook.
Definition at line 53 of file HookRunner.php.
MediaWiki\ResourceLoader\HookRunner::onResourceLoaderSiteStylesModulePages | ( | $skin, | |
array & | $pages | ||
) |
Change which wiki pages comprise the site.styles
module in given skin.
This hook is called from ResourceLoaderSiteStylesModule.
string | $skin | Current skin key |
array | &$pages | Array of pages and their types |
Implements MediaWiki\ResourceLoader\Hook\ResourceLoaderSiteStylesModulePagesHook.
Definition at line 61 of file HookRunner.php.