You are here

function mobile_switch_system_themes_page_alter in Mobile Switch 7.2

Same name and namespace in other branches
  1. 7 mobile_switch.module \mobile_switch_system_themes_page_alter()

Implements hook_system_themes_page_alter().

Alter the displayed theme informations of the used mobile theme.

File

./mobile_switch.module, line 393
Provides various functionalities to develop mobile ready websites.

Code

function mobile_switch_system_themes_page_alter(&$theme_groups) {
  $mobile_theme = variable_get('mobile_switch_mobile_theme', 'none');
  if ($mobile_theme === 'none' || $mobile_theme === 'detectonly' || $mobile_theme === 'redirect') {
    return;
  }

  // Theme switch as operating mode.
  foreach ($theme_groups['enabled'] as $key => $theme) {
    if ($theme->name == $mobile_theme) {
      $theme_groups['enabled'][$key]->notes[] = t('default mobile theme by !mobile-switch', array(
        '!mobile-switch' => l(t('Mobile Switch'), 'admin/config/user-interface/mobile-switch', array(
          'attributes' => array(
            'title' => t('Administer Mobile Switch'),
          ),
        )),
      ));
      $theme_groups['enabled'][$key]->classes[] = 'theme-default';
      $theme_groups['enabled'][$key]->classes[] = 'theme-default-mobile';

      // Remove mobile theme links 'Disable' and 'Set default'.
      foreach ($theme->operations as $op_key => $op) {
        if ($op['href'] == 'admin/appearance/disable') {
          unset($theme_groups['enabled'][$key]->operations[$op_key]);
        }
        if ($op['href'] == 'admin/appearance/default') {
          unset($theme_groups['enabled'][$key]->operations[$op_key]);
        }
      }
    }
  }
}