You are here

function nice_menus_init in Nice Menus 6

Same name and namespace in other branches
  1. 6.2 nice_menus.module \nice_menus_init()
  2. 7.2 nice_menus.module \nice_menus_init()

Implementation of hook_init().

We are adding the JavaScript and CSS here rather than theme_nice_menu because when block caching is enabled none of it would get fired and the menus are unstyled.

File

./nice_menus.module, line 188
Module to enable CSS dropdown and flyout menus.

Code

function nice_menus_init() {

  // Add JavaScript, if enabled.
  if (variable_get('nice_menus_ie', 1) == 1) {
    drupal_add_js(drupal_get_path('module', 'nice_menus') . '/nice_menus.js');
  }

  // Add main CSS functionality.
  drupal_add_css(drupal_get_path('module', 'nice_menus') . '/nice_menus.css');

  // Add custom CSS layout if specified.
  if ($custom = variable_get('nice_menus_custom_css', '')) {
    drupal_add_css($custom);
  }
  else {
    drupal_add_css(drupal_get_path('module', 'nice_menus') . '/nice_menus_default.css');
  }
}