This is a pretty common form element but I can't seem to find out where to adjust it to add in the label.

CommentFileSizeAuthor
screen-capture-67.png118.07 KBmgifford

Comments

Everett Zufelt’s picture

Title: Image Upload Lacks Labels » Image file upload lacks labels
Component: image.module » file.module

I haven't looked, but @davereid told me on IRC that we should be looking in file.module

Everett Zufelt’s picture

EverettZ
Curious if anyone knows where the image upload form in d7 is generated? can't seem to find it in image.module  
davereid
it's in file.module  
EverettZ
davereid: thanks.  
marcingy
isn't it in image.field.inc  
davereid
yes, but it re-uses file_field_widget_form  
davereid
image_field_widget_form?  
Druplicon
image_field_widget_form: Implements hook_field_widget_form(). => image_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta,
$element) =>
http://api.drupal.org/api/function/image_field_widget_form/7  
marcingy
yes very true it is wrapper to the file field widget  

mgifford’s picture

I've tried adding in a title element even in a rough form in

file_field_widget_form() in modules/file/file.field.inc

or

image_field_widget_form() in modules/image/image.field.inc

Using witty little pieces of PHP like:

  $elements[0]['#title'] = 'look here!';

To see if I can get it to appear in the right place. And I almost can. However, I'm hitting the wrong form ID. It should be "edit-field-image-und-0-upload" but It is just listed as "edit-field-image-und-0".

Any other thoughts on how to nudge this ahead?

sun’s picture

Status: Active » Closed (duplicate)
mgifford’s picture

Status: Closed (duplicate) » Active

There is no patch to move here.

It might make sense when there is something to bring into core to meld into a master patch, but there isn't something here in this instance to merge.

The expertise for the file.module are here and it needs to sit with this component until there is a solution.

Stuffing it into a master patch will just ensure that it will get lost.

Everett Zufelt’s picture

Priority: Normal » Major

Setting to priority Major. Missing labels are a WCAG 2.0 level A success criteria. This IMO is major (if not critical).

bowersox’s picture

+1 for this being important to fix

catch’s picture

Version: 7.x-dev » 8.x-dev
Category: bug » task
Issue tags: +Needs backport to D7

Moving to a task, not clear if this was ever fixed in the other patch or not.

Everett Zufelt’s picture

@mgifford

It appears that this issue is fixed in D7-dev. Can you please confirm, and perhaps confirm in D8 head as well?

chx’s picture

Status: Active » Fixed
<div class="field-type-image field-name-field-img field-widget-image-image form-wrapper" id="edit-field-img"><div id="edit-field-img-und-0-ajax-wrapper"><div class="form-item form-type-managed-file form-item-field-img-und-0"> 
  <label for="edit-field-img-und-0">Nice image </label> 
 <div class="image-widget form-managed-file clearfix"><div class="image-widget-data"><input type="file" id="edit-field-img-und-0-upload" name="files[field_img_und_0]" size="22" class="form-file" /><input type="submit" id="edit-field-img-und-0-upload-button" name="field_img_und_0_upload_button" value="Upload" class="form-submit" /><input type="hidden" name="field_img[und][0][fid]" value="0" /> 
<input type="hidden" name="field_img[und][0][display]" value="1" /> 
</div></div> 
<div class="description">Files must be less than <strong>2 MB</strong>.<br />Allowed file types: <strong>png gif jpg jpeg</strong>.</div> 
</div>
mgifford’s picture

Thanks chx.

Status: Fixed » Closed (fixed)
Issue tags: -Accessibility, -Needs backport to D7

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