If the description, title and alt fields for an image are all empty, the alt tag will also be empty. I wanted to use the node title as the alt tag in this situation, so I did this:

In lightbox2.formatter.inc line 152, after:

  // Set up the title.
  $image_title = $item_data['description'];
  $image_title = (!empty($image_title) ? $image_title : $item_data['title']);
  $image_title = (!empty($image_title) ? $image_title : $item_data['alt']); 

Added:

  // Use node title as alt tag if description, title and alt fields are empty
  $node = node_load($node->nid);
  $image_title = (!empty($image_title) ? $image_title : $node->title); 

Now, if description, title and alt are empty, the node title will be set as the alt tag.

It would be great to have this as an option under the Lightbox settings, and also perhaps add a number after the alt tag, so that they are somewhat different. What do you think?

Comments

stella’s picture

Status: Active » Fixed

Committed.

ressa’s picture

Great, thanks!

Status: Fixed » Closed (fixed)

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