You are here

function mobile_tools_themes_configuration_form in Mobile Tools 5

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

Configuration form for configuring the mobile context in the theming system

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

File

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

Code

function mobile_tools_themes_configuration_form() {
  $themes = mobile_tools_list_theme_names();
  $prefix = '';
  if (count($themes) == 0) {
    $warning = '<div class="message error">You must enable themes in order to use theme switching</div>';
  }
  $form['mobile_tools_theme_configuration'] = array(
    '#type' => 'fieldset',
    '#title' => t('Theming configuration'),
    '#collapsible' => TRUE,
    '#description' => t('You can assign a variation of your current theme to all mobile users . this allows you to configure your theme
      specific for mobile users. See !url for more information on this configuration.', array(
      '!url' => l('help', 'help'),
    )),
    '#suffix' => t('If enabled, !configure the settings of your mobile theme and manage the !blocks layout', array(
      '!configure' => l('configure', 'admin/build/themes'),
      '!blocks' => l('blocks', 'admin/build/block'),
    )) . '<br>',
    '#prefix' => $warning,
  );
  if (count($themes) > 0) {
    $form['mobile_tools_theme_configuration']['mobile_tools_enable_theme'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable the mobile theme'),
      '#default_value' => variable_get('mobile_tools_enable_theme', 0),
      '#description' => t('This option will only work if you have manually created a second *.info file in your theme directory.'),
    );
    $form['mobile_tools_theme_configuration']['mobile_tools_theme_name'] = array(
      '#type' => 'select',
      '#title' => t('Mobile theme'),
      '#default_value' => variable_get("mobile_tools_theme_name", FALSE),
      '#options' => $themes,
      '#description' => t('Select your mobile theme.'),
    );

    // for each group, checkbox and dropdown
    // Mobile
    $mobile_groups = module_invoke(variable_get('mobile-tools-device-detection', 'mobile_tools'), 'device_groups');
    $mobile_detection_module = variable_get('mobile-tools-device-detection', 'mobile_tools');
    foreach ($mobile_groups as $group) {
      $form['mobile_tools_theme_configuration'][$mobile_detection_module . '_' . $group] = array(
        '#type' => 'fieldset',
        '#title' => $group,
        '#collapsible' => TRUE,
      );
      $form['mobile_tools_theme_configuration'][$mobile_detection_module . '_' . $group][$mobile_detection_module . '_' . $group . '_enable'] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable filter for this device group'),
        '#default_value' => variable_get($mobile_detection_module . '_' . $group . '_enable', ''),
        '#description' => t('Choose a theme for this device group'),
      );
      $form['mobile_tools_theme_configuration'][$mobile_detection_module . '_' . $group][$mobile_detection_module . '_' . $group . '_theme'] = array(
        '#type' => 'select',
        '#title' => t('Mobile theme'),
        '#default_value' => variable_get($mobile_detection_module . '_' . $group . '_theme', FALSE),
        '#options' => $themes,
        '#description' => t('Select your mobile theme. See <a href="">help</a> for information on the name'),
      );
    }
  }
  return system_settings_form($form);
}