mediawiki-skins-Vector/Hooks.php
jdlrobson e53b4cf522 Vector should operate in responsive mode when the mobile skin
With MobileFrontend installed applying
?useskin=vector&useformat=mobile will ensure that responsive vector
mode is invoked.

I'm keen to do this, as it would help to have more examples of skins
that are MobileFrontend aware as part of the work I am doing in
T166748

Change-Id: I81edd855a5e96400d1179fb10907fcc30ea43ef7
2017-07-03 15:57:49 -07:00

30 lines
682 B
PHP

<?php
/**
* Hooks.php
*/
/**
* Hook handlers for Vector skin.
*
* Hook handler method names should be in the form of:
* on<HookName>()
*/
class VectorHooks {
/**
* BeforePageDisplayMobile hook handler
*
* Make Vector responsive when operating in mobile mode (useformat=mobile)
*
* @see https://www.mediawiki.org/wiki/Extension:MobileFrontend/BeforePageDisplayMobile
* @param OutputPage $out
* @param SkinTemplate $sk
*/
public static function onBeforePageDisplayMobile( OutputPage $out, $sk ) {
// This makes Vector behave in responsive mode when MobileFrontend is installed
if ( $sk instanceof SkinVector ) {
$sk->enableResponsiveMode();
}
}
}