You are here

function styleswitcher_preprocess_html in Style Switcher 7.2

Prepares variables for html templates: Adds the dynamic CSS to every page.

Default template: html.tpl.php.

Parameters

array $variables: An associative array with html variables. Not used in this preprocessor.

File

./styleswitcher.module, line 112
Module's hooks implementations and helper functions.

Code

function styleswitcher_preprocess_html(array &$variables) {
  global $theme;

  // Construct absolute URL explicitly to work out disabled clean URLs.
  $url = url('styleswitcher/css/' . $theme, array(
    'absolute' => TRUE,
  ));

  // Use drupal_add_css() instead of drupal_add_html_head_link() because we need
  // our alternative stylesheets to overwrite the most other css on the page and
  // in standard html.tpl.php $styles go after $head.
  drupal_add_css($url, array(
    'basename' => 'styleswitcher.active.css',
    // Use the latest standard group to be after the most of other css. Some
    // themes (like Omega) use even latter groups to set their grid layouts
    // hoping they wouldn't be overridden.
    'group' => CSS_THEME,
    'weight' => PHP_INT_MAX,
    // Set 'media' to module name to quickly find this link among other elements
    // in styleswitcher_pre_render_styles().
    'media' => 'styleswitcher',
    // Don't aggregate or compress the dynamic CSS.
    'preprocess' => FALSE,
  ));
}