Closed (fixed)
Project:
Drupal for Facebook
Version:
7.x-3.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2011 at 09:42 UTC
Updated:
15 May 2012 at 16:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
steven jones commentedHere's a patch that calls our implementation manually if it looks like it hasn't been called.
Comment #2
Dave Cohen commentedThanks for report and patch. As for the "abuse" I blame Drupal's api! If you have a better approach let me know.
Comment #3
ianthomas_ukWhy not use hook_init() or hook_boot()? The earlier patch effectively moves the contents of fb_custom_theme() into fb_init() when the site is in maintenance mode.
Comment #4
Dave Cohen commentedModules like fb_canvas.module need to implement hook_custom_theme(), and when implementing it, they need information from fb.module.
Why name it "hook_init()" if it's not the first hook called? Drupal's API is the one inflicting abuse.
I will get this patch in.
Comment #5
ianthomas_ukWhat about moving the code to hook_boot, which is run before hook_custom_theme (I'm not sure if that's a good solution, but it would stop the abuse of hook_custom_theme).
hook_init is called after hook_custom_theme so that you can do theme-specific initialisation. I agree it's not clear though. I'm going to file a documentation bug as currently the docs imply caching is the only difference between the functions.
Comment #6
Dave Cohen commentedWhy can't you do theme-specific initialization after hook_init()?
My understanding is that modules should avoid hook_boot as it makes them incompatible with caching. My understanding is limited. I only moved that code into hook_custom_theme() because something was broken otherwise.
Comment #7
ianthomas_ukAgreed, it would make more sense if there were separate functions.
I'm new to Drupal, but I can't see anything to suggest that would be the case. It looks like Drupal disables external page caching by default (http://drupal.org/node/804864 ), but I don't think modules defining hook_boot() has any impact on that. Obviously the code in hook_boot itself will be run on cached pages which may not be desireable.
Comment #8
Dave Cohen commentedhttp://api.drupal.org/api/drupal/modules%21system%21system.api.php/funct...
The performance admin page warns about the modules that implement this hook, if I recall correctly. I'd rather implement hook_custom_theme() than hook_boot().
I think of hook_custom_theme() as poorly named. I consider it the first hook_init(). I have no idea why people thought it was a good idea to add a hook before hook_init().
Comment #9
ianthomas_ukIn that case I think the attached patch is the best possible solution
Comment #10
Dave Cohen commentedPushed! Sorry for the delay.