Przeglądaj źródła

fix menu paths when mod_rewrite is not available

Ted Serbinski 18 lat temu
rodzic
commit
911791b362
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      simplemenu.module

+ 3 - 3
simplemenu.module

@@ -30,14 +30,14 @@ function menu_bar_menu($may_cache) {
     );
   }
   
+  // We put this in !$may_cache so it's only added once per request
   elseif (user_access('view menu bar')) {
     $path = drupal_get_path('module', 'menu_bar');
-    // Add the CSS for this module
-    // We put this in !$may_cache so it's only added once per request
     drupal_add_css($path .'/menu_bar.css');
   
     // pass in base path to the JS file
-    drupal_add_js(array('menu_bar' => array('basePath' => base_path())), 'setting');
+    // url() handles appending ?q= but in this case, we need to pass in the variable so the menus work when mod_rewrite is off
+    drupal_add_js(array('menu_bar' => array('basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='))), 'setting');
     drupal_add_js($path .'/menu_bar.js');
   }