You are here

function _mobile_switch_generate_html_classes in Mobile Switch 7.2

Prepare HTML body classes to be used in page.tpl.php

Return value

array

See also

mobile_switch_preprocess_html()

1 call to _mobile_switch_generate_html_classes()
mobile_switch_preprocess_html in ./mobile_switch.module
Preprocess variables for html.tpl.php.

File

./mobile_switch.module, line 540
Provides various functionalities to develop mobile ready websites.

Code

function _mobile_switch_generate_html_classes() {
  $classes_array =& drupal_static(__FUNCTION__, array());
  if (empty($classes_array)) {
    $detect = mobile_switch_mobile_detect();
    if ($detect['device_type'] === MOBILE_SWITCH_DEVICE_TYPE_MOBILE || $detect['deskbrowser_usage'] === TRUE) {
      foreach ($detect as $key => $value) {
        if ($value === TRUE) {
          $classes_array[] = str_replace('_', '-', $key);
        }
      }
    }
  }
  return $classes_array;
}