function mobile_theme_form_alter in Mobile Theme 6
Same name and namespace in other branches
- 5 mobile_theme.module \mobile_theme_form_alter()
Alter the system theme settings form to add the mobile theme settings.
File
- ./
mobile_theme.module, line 133
Code
function mobile_theme_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'system_theme_settings') {
if ($form['var']['#value'] == 'theme_settings') {
$form['mobile_theme'] = array(
'#type' => 'fieldset',
'#prefix' => '<div class="theme-settings-right">',
'#suffix' => '</div>',
'#title' => t('Mobile theme'),
'#description' => t('Choose which theme will be used when the user is on a mobile device.'),
'#weight' => -4,
);
// Select box for the detection method.
$form['mobile_theme']['mobile_theme_detection'] = array(
'#type' => 'select',
'#title' => t('Detection method'),
'#description' => t('Choose which method will be used to detect mobile devices. Visit the <a href="@help">help documentation</a> for information on how to add other device detection methods.', array(
'@help' => url('admin/help/mobile_theme'),
)),
'#options' => module_invoke_all('mobile_theme_detection'),
'#default_value' => variable_get('mobile_theme_detection', 'mobile_theme_detect_php'),
);
// Select box for the theme to be used for mobile devices.
$themes = array(
'default' => t('Default'),
);
$options = list_themes();
foreach ($options as $name => $attr) {
if ($attr->status) {
$themes[$name] = $attr->info['name'];
}
}
$form['mobile_theme']['mobile_theme_selection'] = array(
'#type' => 'select',
'#title' => 'Mobile theme',
'#description' => t('The theme to use when serving a mobile device.'),
'#options' => $themes,
'#default_value' => variable_get('mobile_theme_selection', 'default'),
);
$form['#submit'][] = 'mobile_theme_settings_submit';
}
}
}