Manual:Hooks/EnterMobileMode

From MediaWiki.org
Jump to: navigation, search
EnterMobileMode
Available from version MobileFrontend
A hook that runs at the point the mobile site initializes.
Define function:
public static function onEnterMobileMode( $MobileContext ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"EnterMobileMode": [
			"MyExtensionHooks::onEnterMobileMode"
		]
	}
}

For MediaWiki ≤1.25:

$wgHooks['EnterMobileMode'][] = 'MyExtensionHooks::onEnterMobileMode';
Called from: File(s): extensions/MobileFrontend/includes/MobileContext.php

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

Details[edit]

  • $MobileContext - an extension of ContextSource that allows you to check the mode of mobile (e.g. alpha, beta or stable) using isBetaGroupMember() and isAlphaGroupMember() methods.