Download & Extend

Broken display for image fields with media selector and cardinality of 1

Project:Media
Version:7.x-2.0-unstable6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

This issue appears on both 7.x-2.0-unstable6 and 7.x-2.x-dev. An image field with cardinality 1 has a broken display, I'm using the Rubik theme, but I think this is an issue with the rendering of it as the markup seems wrong:

The tag for the "Select media" link is outside the form-item div:

<div class="media-widget form-wrapper mediaBrowserLaunch-processed" id="edit-field-resource-thumbnail-und-0"><div id="edit-field-resource-thumbnail-und-0-title" class="form-item form-type-item">
  <label for="edit-field-resource-thumbnail-und-0-title">Resource Thumbnail </label>
</div>
<div class="preview launcher"></div><a href="#" class="button launcher" id="edit-field-resource-thumbnail-und-0-select">Select media</a><a href="/media/0/edit/nojs" class="ctools-use-modal use-ajax ctools-modal-media-file-edit button edit ajax-processed ctools-use-modal-processed" id="edit-field-resource-thumbnail-und-0-edit" style="display: none; ">Edit media</a><a href="#" class="button remove" id="edit-field-resource-thumbnail-und-0-remove" style="display: none; ">Remove media</a><input class="fid" type="hidden" name="field_resource_thumbnail[und][0][fid]" value="0">
</div>

Please see attached screenshot (note the correctly displaying widget above with Unlimited Cardinality)

AttachmentSizeStatusTest resultOperations
media-widget-bug.png57.45 KBIgnoredNoneNone

Comments

#1

Title:Broken display for file fields with media selector and cardinality of 1 » Broken display for image fields with media selector and cardinality of 1

#2

Still an issue in 7.x-2.0-unstable7. Quick fix is add the 'form-item' CSS class next to the 'media-widget'.
PS: I am also using Rubik for my admin theme.

AttachmentSizeStatusTest resultOperations
media_widget_1833964.patch377 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch media_widget_1833964.patch. Unable to apply patch. See the log in the details link for more information.View details | Re-test

#3

Status:active» needs review

Patch #2 fixed it for me! Rerolled patch in appropriate format.

AttachmentSizeStatusTest resultOperations
1833964-media-single-field-cardinality-display-fix.patch365 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 11 pass(es).View details | Re-test

#4

Thanks for the re-roll.