function mobile_switch_advanced_settings_form in Mobile Switch 7.2
Same name and namespace in other branches
- 6 includes/mobile_switch.admin.inc \mobile_switch_advanced_settings_form()
- 7 includes/mobile_switch.admin.inc \mobile_switch_advanced_settings_form()
Form constructor for the Advanced settings form.
1 string reference to 'mobile_switch_advanced_settings_form'
- mobile_switch_menu in ./
mobile_switch.module - Implements hook_menu().
File
- includes/
mobile_switch.admin.inc, line 128 - Administrative page callbacks for the Mobile Switch module.
Code
function mobile_switch_advanced_settings_form() {
$module_path = drupal_get_path('module', 'mobile_switch');
drupal_add_js($module_path . '/js/mobile_switch.admin.js', array(
'scope' => 'footer',
));
$op_mode = mobile_switch_get_operating_mode();
$form['preventing'] = array(
'#type' => 'fieldset',
'#title' => t('Preventing'),
'#description' => t('Prevention of mobile devices. This allows to bypass mobile devices the Mobile Switch functionality.'),
'#collapsible' => TRUE,
'#collapsed' => variable_get('mobile_switch_prevent_devices', 0) ? FALSE : TRUE,
);
$form['preventing']['mobile_switch_prevent_devices'] = array(
'#type' => 'select',
'#title' => t('Use preventing'),
'#options' => array(
FALSE => t('No'),
TRUE => t('Yes'),
),
'#default_value' => variable_get('mobile_switch_prevent_devices', 0),
);
$description['mobile_switch_prevent_devices_strings'] = t("Configure user agent string parts. Use letters, single white spaces or underscores - no other characters! Do not use the '*' wildcard character! Enter one string per line. Example string parts: <pre>htc_flyer\niPad\nSony Tablet S\nXOOM</pre> The string detection is case insensitive.");
$description['mobile_switch_prevent_devices_strings'] .= ' ' . t('Get a user agent string: In the !development-settings use the <em>Display debugging informations</em> option.', array(
'!development-settings' => l(t('Development settings'), 'admin/config/user-interface/mobile-switch/development'),
));
$form['preventing']['mobile_switch_prevent_devices_strings'] = array(
'#type' => 'textarea',
'#title' => t('Mobile devices identification for preventing'),
'#description' => $description['mobile_switch_prevent_devices_strings'],
'#default_value' => variable_get('mobile_switch_prevent_devices_strings', ''),
'#required' => FALSE,
// #states not usable here; it exists problems with mobile jQuery.
'#element_validate' => array(
'_mobile_switch_prevent_devices_strings_validate',
),
);
// Multisite settings.
if ($op_mode === 'redirect') {
$form['multisite'] = array(
'#type' => 'fieldset',
'#title' => t('Multisite settings'),
//'#description' => 'Prevention of mobile devices. This allows to bypass mobile devices the Mobile Switch functionality.',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
// Shared content.
$form['multisite']['mobile_switch_redirect_shared_content'] = array(
'#type' => 'checkbox',
'#title' => t('Multisite shared content'),
'#description' => t("This is relevant for the building of the redirect URL's. Unchecked: Always redirect to the configured URL's. Checked: Redirect to the URL corresponding to the current used URL."),
'#default_value' => variable_get('mobile_switch_redirect_shared_content', 0),
);
// Mobile site landing path.
$form['multisite']['mobile_switch_redirect_to_mobile_landing'] = array(
'#type' => 'textfield',
'#title' => 'Mobile landing',
'#default_value' => variable_get('mobile_switch_redirect_to_mobile_landing', ''),
'#description' => 'A path relative to the <em>Base URL</em> of the mobile website. Not use a trailing slash.',
'#element_validate' => array(
'_mobile_switch_redirect_to_mobile_landing_validate',
),
'#states' => array(
'invisible' => array(
':input[name="mobile_switch_redirect_shared_content"]' => array(
'checked' => TRUE,
),
),
),
);
// Desktop site landing path.
$form['multisite']['mobile_switch_redirect_to_desktop_landing'] = array(
'#type' => 'textfield',
'#title' => 'Desktop landing',
'#default_value' => variable_get('mobile_switch_redirect_to_desktop_landing', ''),
'#description' => 'A path relative to the <em>Base URL</em> of the desktop website. Not use a trailing slash.',
'#element_validate' => array(
'_mobile_switch_redirect_to_desktop_landing_validate',
),
'#states' => array(
'invisible' => array(
':input[name="mobile_switch_redirect_shared_content"]' => array(
'checked' => TRUE,
),
),
),
);
}
$form['#submit'][] = 'mobile_switch_settings_form_submit';
return system_settings_form($form);
}