Skin:Minerva Neue/Hooks/SkinMinervaDefaultModules
Appearance
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: | $wgHooks['SkinMinervaDefaultModules'][] = 'MyExtensionHooks::onSkinMinervaDefaultModules';
|
Called from: | File(s): Minerva Neue / MobileFrontend extension/SkinMinerva.php, MobileFrontend extension/SkinMinervaBeta.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of other extensions using this hook, see Category:SkinMinervaDefaultModules extensions.
Details
[edit]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.
Usage
[edit]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' );
}