You are here

function fivestar_init in Fivestar 5

Same name and namespace in other branches
  1. 6.2 fivestar.module \fivestar_init()
  2. 6 fivestar.module \fivestar_init()

Implementation of hook_init(). Not that this will cause Drupal to post a warning on the admin screen when agressive caching is activated. Like CCK, Fivestar's use of hook_init IS compatible with agressive caching, we just need a way to annouce that.

File

./fivestar.module, line 68
A simple n-star voting widget, usable in other forms.

Code

function fivestar_init() {

  // Ensure we are not serving a cached page.
  if (function_exists('drupal_set_content')) {
    if (module_exists('content')) {
      include_once drupal_get_path('module', 'fivestar') . '/fivestar_field.inc';
    }

    // Add necessary CSS and JS.
    // TODO: These shouldn't be loaded on every page, but block caching omits
    // CSS and JS files that would be otherwise added.
    fivestar_add_js();
    fivestar_add_css();
  }
}