Skin:Minerva Neue/Hooks/SkinMinervaDefaultModules

SkinMinervaDefaultModules
Available from version master (Gerrit change 125906)
Add or remove modules loaded by Minerva skin.
Define function:
public static function onSkinMinervaDefaultModules( SkinMinerva $skin, array &$modules ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SkinMinervaDefaultModules": "MyExtensionHooks::onSkinMinervaDefaultModules"
	}
}
Called from:File(s): MobileFrontend extension/SkinMinerva.php, MobileFrontend extension/SkinMinervaBeta.php
Interface:SkinMinervaDefaultModulesHook.php

For more information about attaching hooks, see $1.
For examples of extensions using this hook, see Category:SkinMinervaDefaultModules extensions.

DetailsEdit

The array $modules, submitted with this hook, contains a bunch of JavaScript modules which will be loaded. You can change, remove or add modules with this hook.

UsageEdit

To add the module test23 to MobileFrontend, you can use the following code:

// Define the module to load and add a dependency to mobile.stable
$wgResourceModules = array_merge( $wgResourceModules, array(
	'mobile.test23' => $wgMFMobileResourceBoilerplate + array(
		'dependencies' => array(
			'mobile.stable',
		),
		'scripts' => array(
			'javascripts/test23.js',
		),
		'targets' => array( 'mobile' ),
	)
) );

// Hook definition
$wgHooks['SkinMinervaDefaultModules'][] = 'onSkinMinervaDefaultModules';

// add the module to MobileFrontend
function onSkinMinervaDefaultModules( $skin, &$modules ) {
	$modules['test23'] = array( 'mobile.test23' );
}