I needed to drop in some simple CSS on a website which happens to have 'private downloads' configured. I thought I'd use this module.
Problem is:
- with private downloads, file_directory_path() is an absolute path (which may be outside the web root)
- drupal_add_css() and drupal_add_js() expect a relative path.
(So the current behaviour is that you get lines like this in your HTML head:
link type="text/css" rel="stylesheet" media="all" href="//var/www/WHATEVER/customcssjs/css/custom.css?v" <- doesn't work so well :-) )
If we want to keep the path relative, we need to store the CSS/JS files somewhere in the web root => somewhere outside the 'files' path.
I modified the code to be able to do this... but thought I'd better disable that functionality by default, and make sure the users get a warning first. If your file system is set to private downloads, you now get a 'I know what I am doing' checkbox in the admin settings, which you need to tick.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | customcssjs_private_1.patch | 4.77 KB | gold |
| customcssjs_private.patch | 4.69 KB | roderik |
Comments
Comment #1
goldI need this also. Just testing this patch and am getting the following;
I'm assuming that this is due to differences between HEAD at the time of diffing and now.
I'll try and apply this manually and run a new cvs diff.
Comment #2
goldOkay, Can people test this one please?
I've got it working for private files by having customcssjs in the site root. This still isn't an ideal solution but it's working and I'm a little pushed for time to come up with a better option.
Cheers,
Gold