I've been working with both Media module and Manual Crop recently, and noticed that the development version of Manual Crop no longer works with Media, when applied to a field that uses the Media Browser as its widget. This is because it uses the following call in Form API to try and set a custom class on the wrapper surrounding the form field:

$element['#attributes']['class'][] = 'manualcrop-file-' . $fid . '-holder';

This custom class is then picked up by Manual Crop as a way to scope its UI invocation.

However, since the theme function for this field is theme_media_widget, and the classes for this widget are hardcoded, this class can't be applied and the Manual Crop UI no longer works.

This patch allows arbitrary attributes to be applied to elements styled with theme_media_widget. It might come in handy for issues like #2408115: Improve Upload widget accessibility as well.

Comments

geoffreyr’s picture

geoffreyr’s picture

StatusFileSize
new980 bytes

Rerolled against dev.

Status: Needs review » Needs work

The last submitted patch, 2: media-theme_media_widget_flexible-1.patch, failed testing.

joseph.olstad’s picture

error: patch failed: includes/media.fields.inc:427
patch does not apply

geoffreyr’s picture

Status: Needs work » Needs review
StatusFileSize
new998 bytes

Rerolled again against latest dev - let's try this again.

geoffreyr’s picture

Hmm... I know it's just passed the tests, but by the looks of it the ID being passed in is not unique, resulting in the JS not working properly. Had this problem on my local dev environment. Maybe if I append '--widget' to it or something, it will make it sufficiently unique.

joseph.olstad’s picture

@geoffreyr , ok please make that change to the ID and we'll review it :)

geoffreyr’s picture

StatusFileSize
new1011 bytes

OK, reuploaded the patch with the ID change. This should ensure that there aren't any clashes with the upload button.

joseph.olstad’s picture

Issue summary: View changes

  • geoffreyr authored b3c88f9 on 7.x-2.x
    Issue #2511142 by geoffreyr: theme_media_widget ignores attributes set...
joseph.olstad’s picture

Status: Needs review » Fixed

looks good thanks, its committed to the 7.x-2.x branch

Status: Fixed » Closed (fixed)

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