The image_imagelink theme function accepts an array of $attributes but does not pass them on when building the link. This can be accomplished by overriding the function in a theme but seems like it was intended functionality since $attributes is already a parameter. Patch attached.

In order to create thickbox galleries from node images, it must be possible to pass attributes for 'class' and 'rel'.

For anyone that is interested in using theme_imagecache_imagelink with Thickbox, here's an example.

The variables for imagecache preset, filepath, alt and title would need to be set outside of the example code.

 $attributes = array('class' => 'thickbox', 'rel' => 'node-images');
print theme('imagecache_imagelink', $imagecache_preset, $filepath, $alt, $title, $attributes);
CommentFileSizeAuthor
imagecache_theme_imagecache_link.patch602 bytesbittindm

Comments

drewish’s picture

Status: Active » Needs work

It's not clear to me that the attributes should go to the link... perhaps they should go to the image... or maybe we should have two separate arrays.

giorgosk’s picture

What do you mean drewish ?

the thickbox attributes are supposed to go to the link
therefore attributes are needed for link

aklump’s picture

I would vote for the following, as I'm trying to use in combination with lightbox and I need the attributes to go to the link:

function theme_imagecache_imagelink($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
  $image = theme('imagecache', $namespace, $path, $alt, $title);
  $original_image_url = file_create_url($path);
  return l($image, $original_image_url, array('absolute' => FALSE, 'html' => TRUE, 'attributes' => $attributes));
}

I added the , 'attributes' => $attributes to the last line of the function.

Not sure whom to let know this, so I'll just paste here as a comment.

Anonymous’s picture

I agree with #3, I needed custom function like this in my code, with attributes for lightbox 2

razunter’s picture

Please fix this

drewish’s picture

Status: Needs work » Fixed

thanks, committed to DRUPAL-6--2.

Status: Fixed » Closed (fixed)

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

drewish’s picture

also committed to HEAD.