In Drupal 7, when I use filefield_sources-1.4 with imagefield_crop-1.x-dev I cannot get the remote URL functionality to work. Every time I click transfer, the transfer bar disappears and nothing is transferred. The patch I have attached fixes this, as far I can tell.

A review would be appreciated. I don't know if this patch fixes all cases with imagefield_crop or if the patch introduces more issues. Thanks!

I also needed to make a modification to imagefield_crop to for these two modules to work. The issue and patch for imagefield_crop is here: #495210-33: support sources in imagefield_crop widget

CommentFileSizeAuthor
imagefield_crop_compatiblity.patch985 bytesdaveparrish

Comments

quicksketch’s picture

Category: bug » feature
Priority: Major » Normal

Sounds like a feature request to me, adding functionality (or support) that doesn't yet exist.

It doesn't look like your patch will work on form elements that are nested (not sure about that though) or on multi-value form elements (pretty sure that's not going to work). By the looks of things, there shouldn't be any need to use form_alter instead of hook_element_info(). I think this is entirely solvable on the ImageField Crop side of things, or this isn't the right solution for FileField Sources.

daveparrish’s picture

Thanks for the quick reply. I couldn't get hook_element_info() to work. That is the way the code was originally. imagefield_crop sets the #file_value_callbacks for it's widget, which for some reason causes filefield_sources callback set in hook_element_info to not fire. I'm not sure why this is.

If you think the change should go in imagefield_crop, I'ld be happy to put it there. I thought other modules which set the #field_value_callbacks would also have issues with filefield_sources. That's why I made the change here.

I'll look into the nested and multi-value cases.

quicksketch’s picture

Category: feature » support
Status: Needs review » Active

That is the way the code was originally. imagefield_crop sets the #file_value_callbacks for it's widget, which for some reason causes filefield_sources callback set in hook_element_info to not fire. I'm not sure why this is.

It's because property merging in Drupal 7 is dumb, as I commented in #914792: Custom element properties entirely override default element info properties. See comment #38 in that post, it should help you out.

daveparrish’s picture

Thank you. You were right, the change can and should be made entirely in imagefield_crop. I had no idea elements worked that way.

The patch is now here: #495210-34: support sources in imagefield_crop widget

quicksketch’s picture

Status: Active » Fixed

Great, thanks for the followup.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Added imagefield_crop issue.