Jump to content

Extension:MobileFrontend/Hooks/EnterMobileMode

From mediawiki.org
EnterMobileMode
Available from version 1.22.0 (Gerrit change 57060)
A hook that runs at the point the mobile site initializes.
Define function:
public static function onEnterMobileMode( MobileContext $mobileContext ) { ... }
Attach hook:
$wgHooks['EnterMobileMode'][] = 'MyExtensionHooks::onEnterMobileMode';
Called from:File(s): MobileFrontend / includes/MobileContext.php
Function(s): shouldDisplayMobileView

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

Called when MobileFrontend enters the mobile mode (e.g. because of a mobile url, mobile device or useformat=mobile URL parameter) and can be used to get the information, that the request will be handled as a "mobile" request.

Parameters

[edit]
  • $mobileContext: An instance of MobileContext, which represents an extended class of ContextSource. It allows you to check the mode of mobile ('beta' or 'stable') by calling MobileContext::isBetaGroupMember().