Setup
Download and installation
Mobile Plugin for Drupal installs in a few easy steps. A mobile-optimized Drupal theme, mobile_garland, is provided and this or another theme must be installed for the plug-in to work.
Steps:
- Download the latest stable Mobile Plugin -release for your Drupal branch.
- Extract the contents to your sites/all/modules -folder.
- Enable the module and optimizations in Administer > Site building > Modules
- Click the parse and cache -link in the enabled message. This will take minutes!
- Enable the module for your test roles in Administer > User management > Access control
After testing enable the module for all roles in Administer > User management > Access control To enable users to override automatic device detection, add a full/mobile switch -block to a desired region on your site in Administer > Site building > Blocks
Configuration
The module configuration can be found in Administer > Site building > Mobile Plugin
Domain based mobile version
You can use m.domain.com or a similar solution to separate your mobile version from the full version. All desired domains must be configured to point to your Drupal installation. Type your m.domain.com and normal www.domain.com into the settings form.
Automatic device detection
It is strongly recommended that you use WURFL automatic device detection. Exact device detection enables us to make design choices based on a device property or even a single device. Domain separation and device detection work together smoothly.
Alerts
Page caching must be off to support multiple themes! It is a good idea to aggregate and compress css in order to speed up your site for mobile bandwidths.
"While being an install and run solution to mobile-optimize a Drupal site the module is fully configurable. Using rules the module can be configured to assign any number of device groups based on WURFL properties. These groups have individual theme and optimization configurations."
Device groups
Here you can add, edit and test device groups for different mobile devices. Each group can use one of the installed themes and perform only desired optimizations. You may filter out css and js added by other modules. Selecting fewer or different blocks to use in the mobile version of the site is a powerful tool. You can quit a group test in the browser from this same view or by closing the browser session.
Detection rules
You may edit and add rules that inspect WURFL property values. A matching rule with the lightest weight will determine the assigned group. In the main module settings you can find 'Test WURFL' for useful properties. A full list of the properties is available in the http://wurfl.sourceforge.net documentation.
Extending
Themes
We have created a simple theme mobile_garland that is easy to modify and has it’s own documentation. Look at this theme to learn more about creating and modifying a mobile theme.
Modules
hook_mobileplugin_setup(&$group_setup) : $form-array
This hook provides a way to add more options to Hello Mobile group settings. Returns a drupal form-api array to merge with the full form. It is recommended to use a fieldset unique for the extending module. The $group_setup will have the stored values keyed with the option field names. Keys for any unstored values will be missing.
hook_mobileplugin_optimize_dom(&$group_setup, &$dom)
This hook is invoked to modify node fields as html-dom before viewing the node. This is a place to do general content optimizations. The optimized values will be cached. The $dom is an object of http://simplehtmldom.sourcefor
It is straight forward to make your site serve mobile-compatible content. Designing mobile user experience is more complicated and depends on the device. For example whether it’s a horizontal screen, touch screen or qwerty-keyboard has a big impact on the user interface. Any module may adjust itself using the information provided and configured into Mobile Plugin.
if (module_exists('mobileplugin') && mobileplugin_is_mobile())
Using module.info to make dependency is an easy way to go. To have less installation requirements you should wrap your mobile optimizations inside this if-clause.
mobileplugin_get_group_setup()
Gets the current active group setup. It is very handy to use the hook_mobileplugin_setup to create group level configuration and get the field values with this function.
mobileplugin_get_wurfl_device()
Gets the detected device as a WURFL PHP API object.
