You are here

function mobile_theme_form_alter in Mobile Theme 5

Same name and namespace in other branches
  1. 6 mobile_theme.module \mobile_theme_form_alter()

Alter the system theme settings form to add the mobile theme settings.

File

./mobile_theme.module, line 22

Code

function mobile_theme_form_alter($form_id, &$form) {
  if ($form_id == 'system_theme_settings') {
    if ($form['var']['#value'] == 'theme_settings') {
      $themes = array(
        'default' => t('Default'),
      );
      $options = list_themes();
      foreach ($options as $name => $attr) {
        if ($attr->status) {
          $themes[$name] = $attr->name;
        }
      }
      $form['mobile_theme'] = array(
        '#type' => 'fieldset',
        '#prefix' => '<div class="theme-settings-right">',
        '#suffix' => '</div>',
        '#title' => t('Mobile theme'),
        '#description' => t('Choose which theme will be used when the user is on a mobile device. Please note that <em>Browscap</em> must be <a href="@browscapconfigruation">configured properly</a>.', array(
          '@browscapconfigruation' => url('admin/settings/browscap'),
        )),
        'mobile_theme_selection' => array(
          '#type' => 'select',
          '#title' => 'Mobile theme',
          '#description' => t('The theme to use when serving a mobile device.'),
          '#options' => $themes,
          '#default_value' => variable_get('mobile_theme_selection', 'default'),
        ),
        '#weight' => -4,
      );
      $form['#submit']['mobile_theme_settings_submit'] = array();

      // 'mobile_theme_settings_submit';
    }
  }
}