when opening a file with lightbox, the link to download the original file is missing. it appears in other lightbox presets such as on cck image fields.

Idan

Comments

iva2k’s picture

Title: download original file - lightbox » Custom *box presets (e.g. download original file - lightbox)
Version: 6.x-2.4 » 6.x-2.x-dev

I doubt I will be rolling individual presets, but I will think of providing a way to define custom presets (would be a better feature to have). Meanwhile, you may want to look into two functions that define existing presets, and try inserting your own in there:

  • itweak_upload.admin.inc:_itweak_upload_setting_link_options()
  • upload.module:_itweak_upload_get_link_options()
arbel’s picture

Hi,

can I access the url of the image from here?
_itweak_upload_get_link_options()

Idan

iva2k’s picture

Status: Active » Needs review

Good question. The answer is no in the current code. I expect your next question is how would you get what the file is in order to build a link options properly. Current code arrangement builds options once for the whole node, and each file gets those options. It prevents from doing what you need to do to format the links.

To resolve that I did some refactoring and checked into -dev CVS. Now there is a file object passed to _itweak_upload_get_link_options().

All you have to do in the new code is find this line (in lightbox2grouped):

        $handler = 'lightbox' . ($group ? '[attachment-thumb-' . $group . ']' : '[attachment-thumb]');

and add after it:

        $handler .= '[<a href="' . $href . '">' . $text . '</a>]';

I verified - it puts a link to the original file in the lightbox.

I'm still on the fence in regards to putting this last change into CVS. At a minimum, I would like to have a theme call there, so the links can be formatted differently by other modules or themes. Any thoughts on that?

iva2k’s picture

Status: Needs review » Fixed

I've committed the above code to 6.x-2.x-dev CVS. Please reopen if this still does not work for Lightbox.

Status: Fixed » Closed (fixed)

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