Closed (fixed)
Project:
Image Assist
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Feb 2007 at 09:45 UTC
Updated:
22 Mar 2007 at 23:15 UTC
Jump to comment: Most recent file
Comments
Comment #1
TobiasH commentedUnfortunately I cannot locate the bug. At the moment I must edit every image after uploading it to select the taxonomy terms. Perhaps someone who is more experienced could take a look at it. thx
Comment #2
zoo33 commentedI suspect it has to do with this patch which removed some form logic. This probably needs some investigation. Maybe we have to revert some of those changes and work around the problems that we had some other way. I don't have time to work on it right now, but hopefully later. Until then, if someone wants to have a look, well, you're always welcome!
Comment #3
TobiasH commentedI think it has to do with the img_assist_node_add function arround the line 603.
If I change the line before last to
then the form is complete, but the form submit redirects to frontpage again. I don't know if this can help anyone to fix this.
Comment #4
moonray commentedLooks to me like the callbacks aren't being done. All the missing parts are from hook_form_alter functions from other modules. I don't think the patch that you are referring to did this.
Definitely needs looking into.
Comment #5
moonray commentedOK, yep, just as I thought.
Because the form has a custom form_id (version 4.7 didn't have this problem, it's a 5.0 issue), when the modules check for
$form['type']['#value'] . '_node_form' == $form_id, they no longer getimage_node_form, butimg_assist_node_form.And so they don't execute the script...
Comment #6
moonray commentedOK, this patch works. But... it's not very pretty and might cause some damage (not sure), since it violates some rules.
It uses
image_node_form($node)as the function name, rather than a function name preceded byimg_assist(which is drupal's version of namespaces).Maybe someone else can come up with a better solution?
Comment #7
moonray commentedSorry, scrap that last patch (I should test more thoroughly before submitting!).
Comment #8
zoo33 commentedPhew. I just put a couple of hours' work into this, and I think it may have been worth it.
I managed to get rid of the node form functions and just rely on image.module's own form handling. The only thing that needs to be treated differently in img_assist is really the redirect after an image has been submitted. I defined a second submit callback to image_node_form which allowed me to override the redirect. (I knew that you could define multiple #validate callbacks, but with #submit it was just a wild guess.)
There is no apparent way (to me anyway) that the second #submit callback can catch the nid of the uploaded image. So I added a snippet to img_assist_nodeapi which saves the nid to a global variable as the node is inserted. There may be a better way to do this.
Anyway, if this works it is a lot more simple than the previous solution. (And I think it does work.) So, please try it out and check the code!
Comment #9
TobiasH commentedThank you zoo33! It seems to be a good solution. I'll test it.
Comment #10
TobiasH commentedThe patch in #8 is working for me. Once again, thank you!
Comment #11
zoo33 commentedCommitted.
Thanks for your help investigating this!
Comment #12
moonray commentedNot an issue with the functionality of the code, just some spelling issues.
should be
and for this comment... (are you Swedish by any chance? :-) )
and one more
Comment #13
zoo33 commentedThanks!
Not sure if that's a typical Swedish way of writing plural forms, but yes, I'm Swedish. :)
("Catched"? Hope my old English teacher isn't watching...)
Comment #14
moonray commentedYes, it's very Swedish. I lived in Sweden for a year or two... :-)
Thanks for the fix.
Comment #15
zoo33 commentedOh, I just remembered something. Look at this part:
That functionality was removed by the patch. My intention was to maybe add that back in another function, but it slipped my mind.
Is anyone actually using that? I can't really imagine a use case for it since it's difficult for a user to change the $_GET variables in the case of img_assist's popup window. Maybe it's something that was copied over from node_add()? I checked the current version of that function, but I didn't find any $_GET tricks there...
I suggest we skip it.
Comment #16
moonray commentedI was wondering about the same bit of code a while back, but didn't know what module would use a "blog it" bookmarklet, so I just left it alone.
Comment #17
zoo33 commentedNo one's gonna miss it. I'd be very surprised.
Comment #18
(not verified) commented