function mobile_tools_themes_configuration_form in Mobile Tools 6.2
Same name and namespace in other branches
- 5 mobile_tools.module \mobile_tools_themes_configuration_form()
- 6.3 mobile_tools.admin.inc \mobile_tools_themes_configuration_form()
- 6 mobile_tools.admin.inc \mobile_tools_themes_configuration_form()
- 7.2 mobile_tools.admin.inc \mobile_tools_themes_configuration_form()
Configuration form for configuring the mobile context in the theming system
1 string reference to 'mobile_tools_themes_configuration_form'
- mobile_tools_menu in ./
mobile_tools.module - Implementation of hook_menu().
File
- ./
mobile_tools.admin.inc, line 164 - Generate configuration form and save settings.
Code
function mobile_tools_themes_configuration_form() {
// Get a list of the currently available theme names
$themes = _mobile_tools_list_theme_names();
// Display a warning message if no themes are available
if (count($themes) == 0) {
$form['mobile_tools_theme_warning'] = array(
'#value' => t('You must enable one or more themes in order to use theme switching.'),
);
}
else {
$form['mobile_tools_theme_configuration'] = array(
'#type' => 'fieldset',
'#title' => t('Theme configuration'),
'#collapsible' => TRUE,
'#description' => t('Display a different theme to mobile users.'),
);
$form['mobile_tools_theme_configuration']['mobile-tools-theme-switch'] = array(
'#type' => 'radios',
'#title' => t('Theme switch'),
'#default_value' => variable_get('mobile-tools-theme-switch', 'mobile-tools-no-switch'),
'#options' => array(
'mobile-tools-no-switch' => t('No theme switch'),
'mobile-tools-mobile-device' => t('Switch theme for a mobile device *'),
'mobile-tools-mobile-url' => t('Switch theme based on the URL'),
),
'#description' => t('Choose how theme switching should be handled. *This is not recommended since using one url for both mobile and desktop site disable the drupal caching.'),
);
$form['mobile_tools_theme_configuration']['mobile_tools_theme_name'] = array(
'#type' => 'select',
'#title' => t('Mobile theme'),
'#default_value' => variable_get("mobile_tools_theme_name", FALSE),
'#options' => $themes,
'#description' => t('Select a theme to display to mobile devices.'),
);
$mobile_detection_module = variable_get('mobile-tools-device-detection', NULL);
if (isset($mobile_detection_module)) {
$mobile_groups = module_invoke($mobile_detection_module, 'device_groups_info');
$form['mobile_tools_group_config'] = array(
'#type' => 'fieldset',
'#title' => t('Configure mobile theme per device group'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('Display different themes to different groups of devices.'),
);
foreach ($mobile_groups as $group => $group_title) {
$form['mobile_tools_group_config'][$mobile_detection_module . '_' . $group] = array(
'#type' => 'fieldset',
'#title' => $group_title,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['mobile_tools_group_config'][$mobile_detection_module . '_' . $group][$mobile_detection_module . '_' . $group . '_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable theme configuration for this device group'),
'#default_value' => variable_get($mobile_detection_module . '_' . $group . '_enable', ''),
);
$form['mobile_tools_group_config'][$mobile_detection_module . '_' . $group][$mobile_detection_module . '_' . $group . '_theme'] = array(
'#type' => 'select',
'#title' => t('Mobile theme'),
'#default_value' => variable_get($mobile_detection_module . '_' . $group . '_theme', FALSE),
'#options' => $themes,
'#description' => t('Select a theme to display to mobile devices which are part of this device group.'),
);
}
}
}
return system_settings_form($form);
}