Manual:Hooks/ResourceLoaderGetLessVars

From MediaWiki.org
Jump to navigation Jump to search
ResourceLoaderGetLessVars
Available from version 1.25.0 (Gerrit change 187986)
Allows to add context-based Less variables.
Define function:
public static function onResourceLoaderGetLessVars( &$lessVars ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ResourceLoaderGetLessVars": "MyExtensionHooks::onResourceLoaderGetLessVars"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ResourceLoaderGetLessVars'][] = 'MyExtensionHooks::onResourceLoaderGetLessVars';
Called from:File(s): ResourceLoader.php

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

Details[edit]

Instead of using $wgResourceLoaderLESSVars to add Less variables, use this hook if you need to add variables, that are context-based.

  • &$lessVars - An array of already added variables, which can be extended