Skin:Minerva Neue/Hooks/SkinMinervaDefaultModules

Jump to navigation Jump to search
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 Manual:Hooks .
For examples of extensions using this hook, see Category:SkinMinervaDefaultModules extensions.


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.


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(
		'scripts' => array(
		'targets' => array( 'mobile' ),
) );

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

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