You are here

function mobile_switch_development_settings_form in Mobile Switch 7.2

Same name and namespace in other branches
  1. 6 includes/mobile_switch.admin.inc \mobile_switch_development_settings_form()
  2. 7 includes/mobile_switch.admin.inc \mobile_switch_development_settings_form()

Form constructor for the Development settings form.

1 string reference to 'mobile_switch_development_settings_form'
mobile_switch_menu in ./mobile_switch.module
Implements hook_menu().

File

includes/mobile_switch.admin.inc, line 216
Administrative page callbacks for the Mobile Switch module.

Code

function mobile_switch_development_settings_form() {
  $module_path = drupal_get_path('module', 'mobile_switch');
  drupal_add_js($module_path . '/js/mobile_switch.admin.js', array(
    'scope' => 'footer',
  ));
  $form['development'] = array(
    '#type' => 'fieldset',
    '#title' => t('Development'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#prefix' => '<div class="development-settings">' . t('Mobile Switch can help to develop a mobile site.') . '</div>',
    '#states' => array(
      'invisible' => array(
        ':input[name="mobile_switch_mobile_theme"]' => array(
          'value' => 'none',
        ),
      ),
    ),
  );
  $form['development']['mobile_switch_developer'] = array(
    '#type' => 'select',
    '#title' => t('Developer modus'),
    '#description' => t('Extends the browser detection for desktop emulators such as <em>Opera mobile</em>, <em>Fennec</em> or more other. Don\'t use it on production sites.'),
    '#options' => array(
      FALSE => t('No'),
      TRUE => t('Yes'),
    ),
    '#default_value' => variable_get('mobile_switch_developer', 0),
  );
  $advanced_collapsed = FALSE;
  if (variable_get('mobile_switch_display_mobiledetectinfo', 0)) {
    $advanced_collapsed = TRUE;
  }
  $form['development']['advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced developer modus settings'),
    '#collapsible' => TRUE,
    '#collapsed' => $advanced_collapsed ? FALSE : TRUE,
  );
  $form['development']['advanced']['mobile_switch_emulator_strings'] = array(
    '#type' => 'textarea',
    '#title' => t('Mobile emulator identification'),
    '#description' => 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. As example the default string parts: <pre>Fennec\nAndroid\nTablet\nMobi</pre> The string detection is case insensitive."),
    '#default_value' => variable_get('mobile_switch_emulator_strings', "Fennec\nAndroid\nTablet\nMobi"),
    '#required' => TRUE,
    '#element_validate' => array(
      '_mobile_switch_emulator_strings_validate',
    ),
  );
  if (variable_get('mobile_switch_mobile_theme', 'none') != 'redirect') {
    $form['development']['mobile_switch_deskbrowser'] = array(
      '#type' => 'select',
      '#title' => t('Desktop browser'),
      '#description' => t('Use the %mobile-theme with desktop browsers. Do not forget to turn off this option on production sites.', array(
        '%mobile-theme' => t('Mobile theme'),
      )),
      '#options' => array(
        FALSE => t('No'),
        TRUE => t('Yes'),
      ),
      '#default_value' => variable_get('mobile_switch_deskbrowser', 0),
    );
  }
  $form['development']['mobile_switch_display_mobiledetectinfo'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display debugging informations'),
    '#description' => t('Display of Mobile Switch informations on each page. Do not forget to turn off this option. For the display is required: the permissions %administer-site-configuration or %administer-themes.', array(
      '%administer-site-configuration' => t('Administer site configuration'),
      '%administer-themes' => t('Administer themes'),
    )),
    '#default_value' => variable_get('mobile_switch_display_mobiledetectinfo', 0),
  );
  $form['#submit'][] = 'mobile_switch_settings_form_submit';
  return system_settings_form($form);
}