You are here

function glazed_helper_preprocess_page in Glazed Theme Helper 7

Implements hook_preprocess_page().

Inject code to create the white "Theme Settings" button in the admin toolbar

File

./glazed_helper.module, line 14

Code

function glazed_helper_preprocess_page(&$vars) {
  global $user;
  if ($user->uid == 1 || user_access('access administration pages')) {
    $themes = list_themes();
    if (isset($themes['glazed'])) {
      $glazed = 'glazed';
    }
    elseif (isset($themes['glazed_free'])) {
      $glazed = 'glazed_free';
    }
    else {
      $glazed = FALSE;
    }
    if ($glazed) {
      $theme_path = drupal_get_path('theme', $glazed);
      drupal_add_js(array(
        'glazed' => array(
          'glazedPath' => $theme_path,
        ),
      ), 'setting');
      drupal_add_js(array(
        'glazedDefaultTheme' => variable_get('theme_default'),
      ), 'setting');
      drupal_add_js($theme_path . '/js/minified/' . $glazed . '.admin.min.js', 'file');
      drupal_add_css($theme_path . '/css/' . $glazed . '.admin.css');
    }
  }
}