If you have a profile type that has an entity reference field(referencing any entity type) that uses Inline Entity Form, When you try to create a new entity with the form and press save it fails to add and gives no error.
Below might be the cause that I have identified:
The profiles don't get attached to the user_profile_form until after "inline_entity_form_form_alter" has fired. This means the "profile2_form_submit_handler()" and "#ief_submit_all" flag never gets set. If you create your own hook menu to load the profile2 form directly using entity_ui_get_form. It works correctly.
The comment in Profile 2 says:
Ensure that execution of "profile2_form_user_register_form_alter()" is happens after all other implementations of "hook_form_FORM_ID_alter()"
However this has the side effect of also affecting "profile2_form_user_profile_form_alter" so the profiles are getting attached too late.
I believe this should be fixed here in Profile2
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | profile2_inline_entity_form-2449913-10.patch | 583 bytes | imclean |
Comments
Comment #1
antonyanimator commentedAny solutions to a way around this / fix?
Comment #2
nimoatwoodwaysec commentedAlso need a solution. Any ideas?
Comment #3
antonyanimator commentedIts started working for me, not too sure why. I'll investigate and report back
Comment #4
paulmartin84 commentedI fixed this by adding this to a custom module, However this may have other undesired results, altering module weights could probably achieve similar results. Ideally this would be fixed in Profile2 rather than changing IEF's form_alter to fire later.
Comment #5
antonyanimator commentedHi, any updates on this? Changing module weights doesn't work
Comment #6
antonyanimator commented@paulmartin84
Creating a custom module using your code works well for me. What do you think the undesired results may be?
Comment #7
welly commentedThe function in #4 seems to be working well for me also. No undesired results as of yet.
Comment #8
spleshkaChanging the issue status, will review the suggested patch when I find some time.
Comment #9
imclean commentedThis adds the code in #4 to Profile2. Even though it works, I'm also not sure if it's the best way to go.
Comment #10
imclean commentedThe patch didn't attach for some reason.
Comment #11
rcodinaPatch on #10 works for me so +1 to RTBTC
@imclean Thank you so much!
Comment #12
rminkov commentedIt works for me too. Thanks.
Comment #13
mkrizaj commentedPatch #10 works for me as well!
Comment #14
rcodinaThree good reviews means RTBTC
Comment #15
kingandyPatch works for me.
Comment #17
rickj commentedComment #18
rickj commentedI committed this patch to dev (7.x-1.4-dev+3) as it was RTBC, but it seems it was only necessary to correct a side effect of another patch (issue #1097684).
The hook function added by that patch has caused various other side effects as well, so I am proposing taking the function out. Please see this comment, and if possible test the latest dev release with the patch in that comment applied.
Thanks
Comment #20
rcodinaI have updated Profile2 v1.3 (using patch on #10) to the new v1.6 and the error is back. I have opened a new issue: #3082062: Using inline entity form widget on a Profile2 field fails to work