You are here

function sweaver_preprocess_page in Sweaver 6

Same name and namespace in other branches
  1. 7 sweaver.module \sweaver_preprocess_page()

Implementation of hook_preprocess_page().

File

./sweaver.module, line 320
Sweaver functions.

Code

function sweaver_preprocess_page(&$vars) {

  // Load css for this theme if available.
  if (ctools_static('load_style')) {
    $sweaver = Sweaver::get_instance();

    // Extra check for the theme if we need to load css files.
    if (ctools_static('load_style')) {
      if (!empty($GLOBALS['custom_theme'])) {
        $sweaver
          ->set_current_style($GLOBALS['custom_theme']);
      }
    }
    $sweaver_style = $sweaver
      ->get_current_style();
    if (isset($sweaver_style->css)) {
      $css = $vars['css'];
      $css_path = file_directory_path() . '/sweaver/sweaver_' . $sweaver
        ->get_theme_key() . '_' . $sweaver_style->style_id . '_' . $sweaver_style->type . '.css';
      drupal_add_css($css_path, 'theme');
      $vars['css']['all']['theme'][$css_path] = TRUE;
      $vars['styles'] = drupal_get_css();
      foreach (array_keys($sweaver
        ->get_plugins_registry(TRUE)) as $plugin_name) {
        $sweaver_plugin = $sweaver
          ->get_plugin($plugin_name);

        // Fire preprocess.
        $sweaver_plugin
          ->sweaver_preprocess_page($vars);
      }
    }
  }
}