function mobile_switch_block_block_view in Mobile Switch Block 7
Same name and namespace in other branches
- 7.2 mobile_switch_block.module \mobile_switch_block_block_view()
Implements hook_block_view()
File
- ./
mobile_switch_block.module, line 284 - Extends the Mobile Switch module with an theme switch block.
Code
function mobile_switch_block_block_view($delta) {
global $conf;
if ($conf['mobile_switch_theme_mobile'] === 'none') {
return;
}
$get['deskbrowser'] = (bool) variable_get('mobile_switch_deskbrowser', FALSE);
$get['developer'] = (bool) variable_get('mobile_switch_developer', FALSE);
$get['browser'] = mobile_switch_browscap_get_browser($get['developer']);
$block = array();
switch ($delta) {
case 'switch':
if ((bool) $get['browser']['ismobiledevice'] === TRUE && (bool) $get['browser']['prevent_device'] === FALSE || $get['deskbrowser'] === TRUE && (bool) $get['browser']['ismobiledevice'] === FALSE) {
$block['subject'] = t('Theme switch');
$block['content'] = theme('mobile_switch_block_switch_content');
}
break;
}
return $block;
}