You are here

function mobile_tools_admin_settings_form in Mobile Tools 7.3

Admin form for global Mobile Tools settings

1 string reference to 'mobile_tools_admin_settings_form'
mobile_tools_menu in ./mobile_tools.module
Implements hook_menu().

File

./mobile_tools.admin.inc, line 55
Adminstrative pages for Mobile Tools

Code

function mobile_tools_admin_settings_form($form, &$form_state) {
  $form['mobile_tools_enable_view_modes'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable entity build modes'),
    '#description' => t('Create an entity build mode for each device group.'),
    '#default_value' => variable_get('mobile_tools_enable_view_modes', FALSE),
    '#access' => user_access('administer mobile tools'),
  );

  // Load the list of detector modules
  $detectors = _mobile_tools_get_device_detectors();
  $form['mobile_tools_enable_redirection'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable device redirection'),
    '#description' => empty($detectors) ? t('To enable device redirection you must enable a device detector module (ex: Mobile Tools Browscap).') : t('Allow users to be redirected to the appropriate device group URL.'),
    '#default_value' => variable_get('mobile_tools_enable_redirection', FALSE),
    '#disabled' => empty($detectors),
    '#access' => user_access('administer mobile tools'),
  );
  $form['redirection'] = array(
    '#type' => 'fieldset',
    '#title' => t('Redirection'),
    '#description' => t('Configure redirection settings.'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#access' => user_access('administer mobile tools'),
    '#states' => array(
      'visible' => array(
        ':input[name=mobile_tools_enable_redirection]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
    '#access' => user_access('administer mobile tools'),
  );
  $form['redirection']['mobile_tools_redirection_type'] = array(
    '#type' => 'radios',
    '#title' => t('Redirection Type'),
    '#description' => t('Redirect the user using a server-side redirect or using client-side javascript.'),
    '#options' => array(
      MOBILE_TOOLS_REDIRECT_SERVER_SIDE => t('Server Side'),
      MOBILE_TOOLS_REDIRECT_CLIENT_SIDE => t('Client Side'),
    ),
    '#default_value' => variable_get('mobile_tools_redirection_type', MOBILE_TOOLS_REDIRECT_SERVER_SIDE),
    '#access' => user_access('administer mobile tools'),
  );
  $form['redirection']['mobile_tools_redirection_auto'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatic redirection'),
    '#description' => t('Enable automatic redirection. This settings is enabled automatically for server-side redirection.'),
    '#default_value' => variable_get('mobile_tools_redirection_auto', TRUE),
    '#states' => array(
      'enabled' => array(
        ':input[name=mobile_tools_redirection_type]' => array(
          'value' => MOBILE_TOOLS_REDIRECT_CLIENT_SIDE,
        ),
      ),
    ),
    '#access' => user_access('administer mobile tools'),
  );
  $form['mobile_tools_global_httpheaders'] = array(
    '#type' => 'textarea',
    '#title' => t('HTTP Headers'),
    '#description' => t('A set of global HTTP headers to include when a device group is active.'),
    '#cols' => 60,
    '#rows' => 5,
    '#default_value' => variable_get('mobile_tools_global_httpheaders', FALSE),
    '#access' => user_access('administer mobile tools'),
  );
  return system_settings_form($form);
}