Markup validation on node edit forum
hefox - October 29, 2009 - 15:38
| Project: | ImageField |
| Version: | 6.x-3.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | active |
Description
<?php
function theme_imagefield_admin_thumbnail($item = NULL) {
...
return '<img src="'. file_create_url($thumb_path) .'" title="' . check_plain($item['filename']) . '" />';
}
?>There's no alt text, making it fail validation.
There's also a warning
1. Warning Line 274, Column 14: reference to non-existent ID "edit-field-icon-0"
<label for="edit-field-icon-0" >Icon </label>cause the id is actually edit-field-icon-0-upload or something. Not sure how to address that.
Patch adds in alt text for that theme function
| Attachment | Size |
|---|---|
| imagefield_alt_text.patch | 614 bytes |

#1
Just a note, alt text should never be the name of a file. If it's decorative then the alt text should just be empty. It's not decorative in this case, something like "Image preview" would be more suitable for a case like this.
#2
Oh :O!
Here's the patch with file name replaced (in a texteditor, so if I managed to get some syntax wrong.. I'll be amused and regretful) with t("Image preview") for the alt text.