You are here

function mobile_switch_settings_form in Mobile Switch 7

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

Form constructor for the Basic settings form.

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

File

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

Code

function mobile_switch_settings_form() {
  $module_path = drupal_get_path('module', 'mobile_switch');
  drupal_add_js($module_path . '/js/mobile_switch.admin.js', array(
    'scope' => 'footer',
  ));
  $form = array();
  $active_themes = array_merge(array(
    'none' => t('Do not use'),
  ), mobile_switch_get_themes());
  $form['global_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Theme settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['global_settings']['mobile_switch_mobile_theme'] = array(
    '#type' => 'select',
    '#title' => t('Mobile theme'),
    '#description' => t('Which theme should be used as default theme when a mobile device detected.'),
    '#options' => $active_themes,
    '#default_value' => variable_get('mobile_switch_mobile_theme', 'none'),
  );
  $form['global_settings']['mobile_switch_admin_usage'] = array(
    '#type' => 'select',
    '#title' => t('Administration usage'),
    '#description' => t('Use the mobile theme on administration pages when a mobile device detected.'),
    '#options' => array(
      FALSE => t('No'),
      TRUE => t('Yes'),
    ),
    '#default_value' => variable_get('mobile_switch_admin_usage', 0),
  );
  $form['#submit'][] = 'mobile_switch_settings_form_submit';
  return system_settings_form($form);
}