You are here

function simplemenu_init in SimpleMenu 6.2

Same name and namespace in other branches
  1. 6 simplemenu.module \simplemenu_init()
  2. 7 simplemenu.module \simplemenu_init()

Implementation of hook_init().

File

./simplemenu.module, line 45
Creates a simplemenu.

Code

function simplemenu_init() {

  // do a simple access check here, since theme isn't available to check yet
  if (user_access('view simplemenu')) {
    $path = drupal_get_path('module', 'simplemenu');
    $simplemenu_theme = variable_get('simplemenu_theme', 'original');
    drupal_add_css($path . '/simplemenu.css');
    if ($simplemenu_theme != 'custom') {
      drupal_add_css($path . '/themes/' . $simplemenu_theme . '/' . $simplemenu_theme . '.css');
    }
    $settings = array(
      'effect' => variable_get('simplemenu_effect', 'opacity'),
      'effectSpeed' => variable_get('simplemenu_effect_speed', 'fast'),
      'element' => variable_get('simplemenu_element', 'body'),
      'hideDelay' => variable_get('simplemenu_hide_delay', 800),
      'placement' => variable_get('simplemenu_element_method', 'prepend'),
      'detectPopup' => variable_get('simplemenu_detect_popop', 1),
    );
    drupal_add_js(array(
      'simplemenu' => $settings,
    ), 'setting');

    //$simplemenu = drupal_to_js(simplemenu_get_menu());

    //drupal_add_js('var simplemenu = '. drupal_to_js(simplemenu_get_menu()) .';', 'inline');
    drupal_add_js($path . '/simplemenu.js');
    drupal_add_js($path . '/superfish.js');
  }
}