I couldn't get the image description, or the node title into the alt tag, so I did this:
In thickbox.module line 194, after:
// If the title is empty use description, alt or the node title in that order.
if (empty($item['data']['title'])) {
if (!empty($item['data']['description'])) {
$item['data']['title'] = $item['data']['description'];
}
else if (!empty($item['data']['alt'])) {
$item['data']['title'] = $item['data']['alt'];
}
else {
$item['data']['title'] = $node->title;
}
}
Added:
// If the alt is empty use description or the node title in that order.
if (empty($item['data']['alt'])) {
if (!empty($item['data']['description'])) {
$item['data']['alt'] = $item['data']['description'];
}
else {
$item['data']['alt'] = $node->title;
}
}
Now, if description and alt are empty, the node title will be set as the alt tag.
Perhaps add a number after the alt tag, so that they are somewhat different. What do you think?
Comments
Comment #1
ressaAlso, I tried to get the function into template.php, but couldn't.
I tried both
function THEMENAME_thickbox_field_formatter($field, $item, $formatter, $node) {-- and
function THEMENAME_field_formatter($field, $item, $formatter, $node) {...but no luck. Is there another way? Hacking modules ain't cool 8o)
Comment #2
frjo commentedPlease test the new Colorbox module and see it that works better.
http://drupal.org/project/colorbox
I have ported all Thickbox features to Colorbox so it should work as a drop in replacement.
When Colorbox has a stable release I will start actively recommend people to switch/upgrade from Thickbox to Colorbox. I'm the maintainer of Thickbox and a co-maintainer of Colorbox.
Comment #3
ressa