You are here

function superfish_init in Superfish 6

Implements hook_init().

File

./superfish.module, line 1319
Enables the use of jQuery Superfish plugin for Drupal menus.

Code

function superfish_init() {
  $directory = superfish_get_path('superfish');
  $slp_default = $directory . "/jquery.hoverIntent.minified.js\n" . $directory . "/jquery.bgiframe.min.js\n" . $directory . "/superfish.js\n" . $directory . "/supersubs.js\n" . $directory . "/supposition.js\n" . $directory . "/sftouchscreen.js\n" . $directory . "/sfsmallscreen.js\n" . $directory . "/sfautomaticwidth.js";
  $sf_library = variable_get('superfish_slp', $slp_default);
  $sf_library = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", trim($sf_library));
  $sf_library = explode("\n", $sf_library);
  foreach ($sf_library as $s) {
    if (file_exists($s)) {
      drupal_add_js($s);
    }
  }
  if (file_exists($directory . '/superfish.js')) {
    drupal_add_js(drupal_get_path('module', 'superfish') . '/superfish.js');
  }
  drupal_add_css($directory . '/css/superfish.css');
  drupal_add_css($directory . '/css/superfish-vertical.css');
  drupal_add_css($directory . '/css/superfish-navbar.css');
  drupal_add_css($directory . '/css/superfish-smallscreen.css');
}