Download & Extend

path_to_theme() call breaks site off-line page

Project:jQuery Lightbox
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

Similar to #178364: path_to_theme() call breaking blocks page, the call to path_to_theme() in jlightbox_add() causes Drupal's site-off-line page to go completely un-themed. I believe this occurs because jlightbox_init() calls jlightbox_add(), and calls to theme functions in hook_init() are not supported.

See #219910: Calling theme function from hook_init() interferes with administration theme for more information.

To replicate:

  1. Enable the jQuery Lightbox module.
  2. Take your site off-line.
  3. Log out.
  4. You will be greeted by your site-off-line message in plain text, the page devoid of any theme/styling whatsoever.

The simple fix is to add an exception for when the site is off-line.

AttachmentSize
jlightbox_maint_fix.patch866 bytes

Comments

#1

Status:needs review» reviewed & tested by the community

Nice one!

#2

Status:reviewed & tested by the community» fixed

Committed to all branches. Thanks!

#3

Status:fixed» closed (fixed)

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

#4

Status:closed (fixed)» needs work

Actually, that's not enough. It helps with offline mode, but if you try to programmatically change current theme from your module in hook_init() updating $custom_theme variable, it is not going to work again (unless you fiddle with module weights).

In my opinion call to path_to_theme() should be ditched from there completely. If someone needs to override styles, it can be easily done through any of the already existing theme CSS files, no real need to load specific jlightbox.css, especially if it breaks the workflow...

nobody click here