You are here

function css_injector_init in CSS Injector 6

Same name and namespace in other branches
  1. 7.2 css_injector.module \css_injector_init()
  2. 7 css_injector.module \css_injector_init()

Implementation of hook_init(). Checks to see whether any CSS files should be added to the current page, based on rules configured by the site administrator.

File

./css_injector.module, line 32
Allows administrators to inject CSS into the page output based on configurable rules. Useful for adding simple CSS tweaks without modifying a site's official theme.

Code

function css_injector_init() {
  $css_rules = _css_injector_load_rule();
  foreach ($css_rules as $css_rule) {
    if (_css_injector_evaluate_rule($css_rule)) {
      drupal_add_css(file_create_path(_css_injector_rule_path($css_rule['crid'])), 'module', $css_rule['media'], $css_rule['preprocess']);
    }
  }
}