You are here

function mobile_tools_external_modules_configuration_form in Mobile Tools 6.2

Same name and namespace in other branches
  1. 6.3 mobile_tools.admin.inc \mobile_tools_external_modules_configuration_form()
  2. 6 mobile_tools.admin.inc \mobile_tools_external_modules_configuration_form()
  3. 7.2 mobile_tools.admin.inc \mobile_tools_external_modules_configuration_form()

Configuration of external modules

1 string reference to 'mobile_tools_external_modules_configuration_form'
mobile_tools_menu in ./mobile_tools.module
Implementation of hook_menu().

File

./mobile_tools.admin.inc, line 262
Generate configuration form and save settings.

Code

function mobile_tools_external_modules_configuration_form() {
  $form['mobile_tools_site_detection'] = array(
    '#type' => 'fieldset',
    '#title' => t('Site detection'),
    '#collapsible' => TRUE,
    '#description' => t('Mobile Tools provides an API which allows other modules or themes to determine if a website visitor is currently viewing the desktop or the mobile site. A site detection module must be installed in order to detect the current site type.'),
  );

  // Get a list of modules which provide site detection
  $site_detection = mobile_tools_get_module_names(module_implements('is_mobile_site'));

  // Display a warning message if no site detection modules are available
  if (empty($site_detection)) {
    $form['mobile_tools_site_detection']['mobile-tools-site-detection-warning'] = array(
      '#value' => t('You must enable one or more site detection modules in order to use site detection.'),
    );
  }
  else {
    $form['mobile_tools_site_detection']['mobile-tools-site-type-detection'] = array(
      '#type' => 'radios',
      '#title' => t('Site detection module'),
      '#default_value' => variable_get('mobile-tools-site-type-detection', NULL),
      '#options' => $site_detection,
      '#description' => t('Choose a module to use for site detection.'),
    );
  }
  $form['mobile_tools_device_detection'] = array(
    '#type' => 'fieldset',
    '#title' => t('Device detection'),
    '#collapsible' => TRUE,
    '#description' => t('Mobile Tools provides an API which allows other modules or themes to determine if a website visitor is using a mobile device. A device detection module must be installed in order to detect devices.'),
  );

  // Get a list of modules which provide device detection
  $device_detection = mobile_tools_get_module_names(module_implements('detect_mobile_device'));

  // Display a warning message if no device detection modules are available
  if (empty($device_detection)) {
    $form['mobile_tools_device_detection']['mobile-tools-device-detection-warning'] = array(
      '#value' => t('You must enable one or more device detection modules in order to use device capability detection.'),
    );
  }
  else {
    $form['mobile_tools_device_detection']['mobile-tools-device-detection'] = array(
      '#type' => 'radios',
      '#title' => t('Device detection module'),
      '#default_value' => variable_get('mobile-tools-device-detection', NULL),
      '#options' => $device_detection,
      '#description' => t('Choose a module to use for device detection.'),
    );
  }
  $form['mobile_tools_device_capability_detection'] = array(
    '#type' => 'fieldset',
    '#title' => t('Device capability detection'),
    '#collapsible' => TRUE,
    '#description' => t("Mobile Tools provides an API which allows other modules or themes to determine the capabilities of a website visitor's mobile device. A device capability detection module must be installed in order to detect device capabilities."),
  );

  // Get a list of modules which provide device capability detection
  $device_capability = mobile_tools_get_module_names(module_implements('determine_device_capability'));

  // Display a warning message if no device capability detection modules are available
  if (empty($device_capability)) {
    $form['mobile_tools_device_capability_detection']['mobile-tools-device-capabilities-warning'] = array(
      '#value' => t('You must enable one or more device capability detection modules in order to use device capability detection.'),
    );
  }
  else {
    $form['mobile_tools_device_capability_detection']['mobile-tools-device-capabilities'] = array(
      '#type' => 'radios',
      '#title' => t('Device capability detection'),
      '#default_value' => variable_get('mobile-tools-device-capabilities', NULL),
      '#options' => $device_capability,
      '#description' => t('Choose a module to use for device capability detection.'),
    );
  }
  return system_settings_form($form);
}