You are here

function styleswitcher_preprocess_page in Style Switcher 6.2

Same name and namespace in other branches
  1. 6 styleswitcher.module \styleswitcher_preprocess_page()

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

Default template: page.tpl.php.

Parameters

array $variables: An associative array with page variables, including but not limited to:

See also

drupal_get_css()

template_preprocess_page()

File

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

Code

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

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

  // Function drupal_get_css() processes only really existing CSS files and not
  // dynamic links so it can't be used. Add link tag directly to the end of all
  // styles - they are already rendered to corresponding variable.
  $variables['styles'] .= '<link type="text/css" rel="stylesheet" media="all" href="' . $url . '" id="styleswitcher-css" />' . "\n";
}