Using the latest dev release of today I found the "Crop media" button was not showing. Turns out it is there but hidden by CSS because it is failing to correctly set an inline style of display:inline-block which would override the media.css rule ".media-widget a.button + a.button".

This is what I get in Chrome's inspector:

<a href="http://localhost/country-gardener/main/imagecrop/overview/1/thumbnail/node/business/field_logo" class="imagecrop-button button imagecrop-processed" title="Crop image" style=" style=&quot;display:inline-block;&quot;">Crop media</a>

Notice how a "style" attribute is being declared within another style attribute. I've yet to test when this bug occurred but I have other sites using older versions of the module that do not have this issue.

This is on a fresh Drupal install.

Comments

magicmyth’s picture

Status: Active » Needs review
StatusFileSize
new1.65 KB

Found the problem. imagecrop_jquery_dialog() uses l() which makes use of drupal_attributes(). However, $style is being passed the string value with 'style="..."', and thus causes a double wrapping of the HTML attribute.

Attached is a patch to fix this issue but I don't know if it will function correctly for other dialogs as I've not checked to see what they are expecting the form of $style to take.

Hopiu’s picture

Thanks for the patch! At least for me it works perfectly well.

mstef’s picture

Status: Needs review » Reviewed & tested by the community

Works

ianthomas_uk’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new698 bytes

Thanks for the patch, unfortunately I can't commit it as it's an API change and does in fact break our other implementations of that function (for colorbox and iframe), plus other custom/contrib modules could be using the API.

Here's an approach that keeps the same API and changes the internals of imagecrop_jquery_dialog instead.

ianthomas_uk’s picture

Status: Needs review » Fixed

Committed and pushed to 7.x-1.x-dev

Status: Fixed » Closed (fixed)

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