You are here

function simplemenu_footer in SimpleMenu 5

Same name and namespace in other branches
  1. 6.2 simplemenu.module \simplemenu_footer()

Implementation of hook_footer()

File

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

Code

function simplemenu_footer() {
  global $theme;
  $exclusions = variable_get('simplemenu_exclusions', array());
  if (user_access('view simplemenu') && !$exclusions[$theme]) {
    global $theme, $custom_theme;
    $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(
      // pass in base path to the JS file
      // url() handles appending ?q= but in this case, we need to pass in the variable so the menus work when mod_rewrite is off
      'basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='),
      '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'),
    );
    drupal_add_js(array(
      'simplemenu' => $settings,
    ), 'setting');
    drupal_add_js('var simplemenu = ' . drupal_to_js(simplemenu_get_menu()) . ';', 'inline');
    drupal_add_js($path . '/simplemenu.js');
  }
}