You are here

function themekey_css_init in ThemeKey 7.3

Implements hook_init().

File

themekey_css/themekey_css.module, line 82

Code

function themekey_css_init() {
  if (themekey_is_active()) {
    require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'themekey') . '/themekey_base.inc';
    $parameters = themekey_get_global_parameters();
    $result = themekey_match_rule_childs($parameters, array(
      'table' => 'themekey_css_rules',
      'format_rule_as_string_callback' => 'themekey_css_format_rule_as_string',
      'check_enabled_callback' => 'themekey_check_css_exists',
    ));
    if (is_array($result) && 'default' != $result['theme']) {
      drupal_alter('themekey_add_css', $result['theme'], $result['rules_matched']);
      drupal_add_css($result['theme'], array(
        'group' => constant($result['css_group']),
        'weight' => $result['css_weight'],
      ));
      if (variable_get('themekey_debug_trace_rule_switching', FALSE)) {
        themekey_set_debug_message('Adding CSS file %css_file.', array(
          '%css_file' => $result['theme'],
        ));
      }
    }
  }
}