I'm not sure if this is a bug, or by design. I'll try to explain as clearly as possible although unfortunately I don't have a solution.
If I understand correctly, modules may use hook_init to define global variables before much of the page processing is done. In particular, it allows moduels like Organic Groups to define $custom_theme based on a node's group. To do this, OG performs the following actions:
1) Node_load on whatever node is currently being viewed
2) Gets it group
3) Loads the group node
4) Gets the custom theme from the group node
5) Sets global $custom_theme to that custom theme
All of this is done from hook_init.
If this node is an event:
1) node_load fires event_nodeapi's load case
2) This calls event_include_files()
3) event_include_files calls path_to_theme()
4) path_to_theme calls init_theme (because it was called from hook_init, init_theme hasn't been called yet and global $path_to_theme is still null)
As a result of this, event type nodes are unable to be properly loaded in any hook_init as they cause the theme to start up before hook_init would like it to, effectively interrupting hook_init.
It makes more sense to file this here than OG to me, however is this is incorrect I'd be happy to move it elsewhere. For a short term solution, as none of my themes implemented event.css I just remove the 'if' check, and always include the default css. This isn't an optimal solution I know, but It Works For Me. I hope the stack trace isn't too detailed, wanted to explain the exact situation that caused me issues.
Thanks,
jrp
Comments
Comment #1
gerhard killesreiter commentedYeah, the situation with event_include_files is far from ideal, but so is OG's way to determine what to do...
I introduced the path_to_theme thing to allow easier customization for event themers. I've no way to know if it is actually used and thus I cannot simly drop it...
Comment #2
pletcher commentedAfter some more poking around and talking to Killes, it looks like OG 6 (both 1.x and 2.x) help avoid this problem by doing group lookups by using menu_get_object instead of node_load. This doesn't necessarily solve the issue outright, but at least this instance of it the issue is taken care of by upgrading to D6. Here is a patch which is very, very tentative which might solve this problem.
Comment #3
rbl commentedJrp,
Thanks for the patch! It set me on the right way and now (at least) the event node pages are themed.
Will poke around too to see if I can do the same with the day, week, month and list ones.
Ricardo
Comment #4
japerryEvent for Drupal 8 is unrelated to older versions. If an issue similar to this one exists, please open a new issue with the 8.x branch.