You are here

function mobile_tools_detection_configuration_form in Mobile Tools 5

Configuration form for the mobile device detection, redirection and notification

Return value

The configuration form

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

File

./mobile_tools.module, line 241
Mobile Tools provides a range of functionality assisting in creating a mobile drupal site . this functionality contains:

Code

function mobile_tools_detection_configuration_form() {
  global $base_url;
  $form['mobile_tools_configuration'] = array(
    '#type' => 'fieldset',
    '#title' => t('Configuration'),
    '#collapsible' => TRUE,
    '#description' => t('Configure the way Drupal detects the end user and how Mobile users are being redirected to your mobile site, or notified on the existence of a mobile site?'),
  );
  $form['mobile_tools_configuration']['mobile_tools_enable_redirect'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable device detection and further processing (redirection / notification / theme switching)'),
    '#description' => t('Enable or disable the notification and redirection functionality!'),
    '#default_value' => variable_get('mobile_tools_enable_redirect', 0),
  );
  $form['mobile_tools_configuration']['mobile_tools_handling'] = array(
    '#type' => 'radios',
    '#title' => t('Select the appropriate method'),
    '#default_value' => variable_get('mobile_tools_handling', 'notification'),
    '#options' => mobile_tools_detection_configuration_options('device handling'),
    '#description' => 'Choose one of these methodes!',
  );
  $form['mobile_tools_configuration']['mobile_tools_mobile_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Mobile URL'),
    '#description' => t('Give the name of your mobile site. It is recommended to use the convention of m.domain .com or www.domain.mobi'),
    '#default_value' => variable_get('mobile_tools_mobile_url', mobile_tools_create_mobile_url($base_url)),
  );
  $form['mobile_tools_configuration']['mobile_tools_desktop_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Desktop URL'),
    '#description' => t('Give the name of your regular website.'),
    '#collapsible' => TRUE,
    '#default_value' => variable_get('mobile_tools_desktop_url', $base_url),
  );
  $form['mobile_tools_notification'] = array(
    '#type' => 'fieldset',
    '#title' => t('Notification options'),
    '#collapsible' => TRUE,
    '#description' => t('Choose a text to be displayed to the visitors of your site and how many times the user gets the message. this will be used if you checked the "Display a notification" checkbox in the above configuration.'),
  );
  $form['mobile_tools_notification']['mobile_tools_times'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of impressions'),
    '#cols' => 2,
    '#default_value' => variable_get('mobile_tools_times', 0),
    '#description' => t('How many times do you want to show a notification (0 means always).'),
  );
  $form['mobile_tools_notification']['mobile_tools_notification_option'] = array(
    '#type' => 'radios',
    '#title' => t('When to display the notifications'),
    '#options' => array(
      t('Always'),
      t('Only when a mobile user looks at the desktop site, or a desktop users looks at the mobile site'),
    ),
    '#default_value' => 0,
  );
  $form['mobile_tools_notification']['mobile_notification'] = array(
    '#type' => 'textarea',
    '#rows' => 2,
    '#title' => t('On the desktop site'),
    '#default_value' => variable_get('mobile_notification', MOBILE_NOTIFICATION),
  );
  $form['mobile_tools_notification']['desktop_notification'] = array(
    '#type' => 'textarea',
    '#title' => t('On the mobile site'),
    '#rows' => 2,
    '#default_value' => variable_get('desktop_notification', DESKTOP_NOTIFICATION),
    '#suffix' => mobile_tools_notification_help(),
  );
  $form['frontpage'] = array(
    '#type' => 'fieldset',
    '#title' => t('Extra'),
    '#collapsible' => TRUE,
  );
  $form['frontpage']['default_nodes_main_mobile'] = array(
    '#type' => 'select',
    '#title' => t('Number of posts on main page for the mobile version'),
    '#default_value' => variable_get('default_nodes_main_mobile', 10),
    '#options' => array(
      1 => 1,
      2 => 2,
      3 => 3,
      4 => 4,
      5 => 5,
      6 => 6,
      7 => 7,
      8 => 8,
      9 => 9,
      10 => 10,
      15 => 15,
      20 => 20,
      25 => 25,
      30 => 30,
    ),
    '#description' => t('The default maximum number of posts to display per page on overview pages such as the main page (on Mobile).'),
  );
  $form['mobile_tools_detection'] = array(
    '#type' => 'fieldset',
    '#title' => t('External detection modules'),
    '#collapsible' => TRUE,
    '#description' => t('You can let other modules do the device detection or detect if your site is being mobilised.'),
  );
  $form['mobile_tools_detection']['mobile-tools-device-detection'] = array(
    '#type' => 'radios',
    '#title' => t('Device detection module'),
    '#default_value' => variable_get('mobile-tools-device-detection', 'mobile_tools'),
    '#options' => _mobile_tools_external('device-detection'),
    '#description' => t('Choose which module is in charge for detecting if the visiting device is a mobile device. The Mobile Tools provides a standard implementation. You can also use other modules'),
  );
  $form['mobile_tools_detection']['mobile-tools-site-type-detection'] = array(
    '#type' => 'radios',
    '#title' => t('Site type detection module'),
    '#default_value' => variable_get('mobile-tools-site-type-detection', 'mobile_tools'),
    '#options' => _mobile_tools_external('site-type-detection'),
    '#description' => 'This option is only used when your Drupal site is used for both the mobile as desktop version of the site.',
  );
  $form['mobile_tools_detection']['mobile-tools-device-capabilities'] = array(
    '#type' => 'radios',
    '#title' => t('Device capability detection'),
    '#default_value' => variable_get('mobile-tools-device-capabilities', 'wurfl'),
    '#options' => _mobile_tools_external('device-capability'),
    '#description' => t('The mobile tools module gives an abstract api in order to get capabilities of the mobile devices. These capability can be fetched by calling mobile_tools_devicecapability($capability). Capability can be for example "is_wireless_device". A full range of parameters can be found on !wurfl you need at least one capability module (like !wurfl2) to use this functionality', array(
      '!wurfl' => l('http://wurfl.sourceforge.net/help_doc.php', 'http://wurfl.sourceforge.net/help_doc.php'),
      '!wurfl2' => l('http://drupal.org/project/wurfl', 'http://drupal.org/project/wurfl'),
    )),
  );
  return system_settings_form($form);
}