When using a private file system, drupal_add_css() cannot be used. Therefore, the path to the CSS file is incorrect or missing. In addition, the icon paths generated within the menu_icons.css file are incorrect. I have tested the following with the File System Download Method set to Private, using a path outside of the document root ( not accessible via the web ).

I will test the patch using the Public Download Method.

Note that it may be useful to change the patch to prepend the menu icons and css paths with "system/files/" instead of using the file_create_url() path. This would prevent the menu_icons.css and the menu icons appearing in your tracker or visitor statistics. The reason this happens is because file_create_url() always uses an absolute path ( with the FQDN ) when Private Downloads are selected. Therefore the stylesheet and icons are requested as external URLs ( e.g. hxxp://mydomain.com/system/files/menu_icons/menu_icons.css ).

The changes I've made to the module are as follows:

--- menu_icons.module   2010-05-05 08:48:26.000000000 -0400
+++ menu_icons-a.module 2010-09-16 03:30:23.000000000 -0400
@@ -154,7 +154,15 @@ function menu_icons_form_submit($form, &
  * Implementation of hook_init().
  */
 function menu_icons_init() {
-  drupal_add_css(menu_icons_directory_path() .'/menu_icons.css');
+  switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
+    case FILE_DOWNLOADS_PUBLIC:
+      drupal_add_css(menu_icons_directory_path() .'/menu_icons.css');
+      break;
+    case FILE_DOWNLOADS_PRIVATE:
+      $url = file_create_url(menu_icons_directory_path() .'/menu_icons.css');
+      $output = '<link type="text/css" rel="stylesheet" media="' . $media . '" href="' . $url . '" />'."\n";
+      drupal_set_html_head($output);
+  }
 }

 /**
@@ -242,12 +250,14 @@ function menu_icons_css_generate() {
       $info = image_get_info($options['menu_icon']['path']);

       // Support private filesystem
-      if (strpos($options['menu_icon']['path'], menu_icons_directory_path()) === 0) {
-        $image_url = file_create_url($options['menu_icon']['path']);
-      }
-      else {
-        $image_url = base_path() . $options['menu_icon']['path'];
+      switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
+        case FILE_DOWNLOADS_PUBLIC:
+          $image_url = base_path() . $options['menu_icon']['path'];
+          break;
+        case FILE_DOWNLOADS_PRIVATE:
+          $image_url = file_create_url($options['menu_icon']['path']);
       }
+
       $css .= theme('menu_icons_css_item', $item['mlid'], $image_url, $info['width'], $pos);
     }
   }

I have attached a patch file.

CommentFileSizeAuthor
menu_icons-private-filesystem-fix.patch1.57 KBjbova
Support from Acquia helps fund testing for Drupal Acquia logo