Hello all together,

 

with this e-mail I want to inform you, that, with change I20e46165fb76[1], we removed a long living Hook in MobileFrontend, called EnableMobileModules. It was added to empower extensions to add modules to OutputPage only, if the page was recognized as requested for a “mobile” friendly output (a mobile device or the “Mobile/Desktop switch” at the bottom of every page). The Hook was deprecated with a notice a long time ago and was now completely removed. Although it seems, that the hook wasn’t used in any extension hosted in Wikimedia git I want to give some hints how to achieve something that was made with the use of this removed hook in extensions that maybe aren’t hosted in Wikimedia’s git.

 

== Register mobile (only) modules ==

If you used the EnablemobileModules hook to register a module only, if the page is a “mobile” page, you should migrate to the ResourceLoader. It provides an easy way to specify the target of a module (as you might know already). So, you can define the module with the mobile target only (‘targets’ => array( ‘mobile’ )) and add the module through the BeforePageDisplay hook. If you need to invest some time to migrate to this way, please allow me to mention, that it could be a good step to think about the size of your modules you want (or already) load for the mobile page, too :) (Think of peoples data plans and network speed :P)

 

== Run code in mobile mode only ==

If you need to run some code only in the “Mobile page” context (only, if a page is requested for the mobile mode) you may have used the EnableMobileModules hook (even if it wasn’t thought for this use case). To use this code in the future, you can use the BeforePageDisplayMobile hook, which already runs along with the EnableMobileModules for a while. It’s nearly a copy of the BeforePageDisplay hook (with the same signature and functioning), but it’s only executed in the mobile mode.

 

If you have any questions about how to migrate some code or some other mobile (code) related things, feel free to e-mail mobile-l or ask in #wikimedia-mobile!

 

Have a nice weekend!

 

Best,

Florian

 

[1] https://gerrit.wikimedia.org/r/#/c/243226/6