Had a link with the class I configured on the greybox adminpage but nothing is happening...checked the source code of the webpage and the js and css of greybox isn't loading...tried to change to the default class which is greybox but nothing happens still.

tried on a fresh install of Drupal 5.0.beta2...and this is the first contrib module i installed.

Comments

tom friedhof’s picture

Assigned: Unassigned » tom friedhof
Status: Active » Reviewed & tested by the community
StatusFileSize
new1.14 KB

The js and css are not getting called on pages that do not contain any nodes. greybox_add_files() is being executed in a hook_nodeapi call, which only gets called when a node is loaded.

I moved the call to hook_menu so it's called on every page regardless if a node is called. I also added $maycache to hook_menu so the menu item for the greybox settings can be cached and not built everytime the page loads.

Gurpartap Singh’s picture

Status: Reviewed & tested by the community » Fixed
StatusFileSize
new1.59 KB
tom friedhof’s picture

Hello Gurpartap, I'm not sure the call needs to go in a hook_init hook. According to the API docs (http://api.drupal.org/api/HEAD/function/hook_init) you only want to put code in a hook_init when you want it to execute every time, even for cached pages. I thought it was best to put greybox_add_files() call in the hook_menu hook. Either way works. Let me know if I've misunderstood hook_init, or if this is just a matter of preference. Thanks.

Gurpartap Singh’s picture

Status: Fixed » Active

Greetings :) Well I had just preferred to use hook_init() for now, although putting it into hook_menu() would be better as far it counts for performance! Will include this change within next release.

Gurpartap Singh’s picture

Version: 5.x-1.0 » 5.x-1.1
Gurpartap Singh’s picture

Status: Active » Fixed

Moved code to hook_menu(). Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)