You are here

function mobile_switch_advanced_settings_form in Mobile Switch 7

Same name and namespace in other branches
  1. 6 includes/mobile_switch.admin.inc \mobile_switch_advanced_settings_form()
  2. 7.2 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 54
Administrative page callbacks for the Mobile Switch module.

Code

function mobile_switch_advanced_settings_form() {
  if (variable_get('mobile_switch_mobile_theme', 'none') == 'none') {
    return mobile_switch_theme_message();
  }
  $module_path = drupal_get_path('module', 'mobile_switch');
  drupal_add_js($module_path . '/js/mobile_switch.admin.js', array(
    'scope' => 'footer',
  ));
  $form['preventing'] = array(
    '#type' => 'fieldset',
    '#title' => t('Preventing'),
    '#description' => t('Prevention of mobile devices. This allows to bypass mobile devices the automatic switching to the mobile theme.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#states' => array(
      'invisible' => array(
        ':input[name="mobile_switch_mobile_theme"]' => array(
          'value' => 'none',
        ),
      ),
    ),
  );
  $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 under <em>Developer modus</em> -> <em>Advanced developer modus settings</em> use the <em>Display user agent</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',
    ),
  );
  $form['#submit'][] = 'mobile_switch_settings_form_submit';
  return system_settings_form($form);
}