When using an old-style .theme file instead of a templating engine, the javascript for outgoing link tracking doesn't work because the module settings are not available to javascript.

The problem is that the settings are added by hook_footer(), but it adds the settings to the "header" scope:

drupal_add_js(array('googleanalytics' => $link_settings), 'setting', 'header');

This is no problem for templates because they gather all variables before starting to render the page. However, .theme files have already printed the header scripts by the time that hook is invoked, so these settings are never added to the page.
This should be reproducible with the chameleon theme from core.

Fix is to either move that code to another hook, or add the settings to the footer instead.

CommentFileSizeAuthor
#2 ga_chameleon_settings_bug1.patch7.56 KBhass

Comments

hass’s picture

Verified. Settings are missing in Chameleon 5.x, but not in 6.x. In D6 I've moved this to hook_init(), but the problem is that D5 hook_init works different here and we need to move this inside hook_menu. I don't like this very much, but i see the issue... :-(

hass’s picture

Status: Active » Needs review
StatusFileSize
new7.56 KB

Patch attached will solve the issue. Please review and test.

hass’s picture

Status: Needs review » Fixed

Fixed in latest DEV

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.