The issue
- When using entityconnect if I edit an entity when I save the updated entity I am returned to the form where I clicked edit. (Works as expected.)
- When using entityconnect if I add an entity when I save the new entity I am sent to the new entity's view page rather than the form where I clicked the add button. (unexpected)
A bit of background
- I'm using the 7.x-1.x-dev release.
- I have an entity built with ECK with updated CRUD paths (hook_entity_info_alter) that references other entities using entity reference fields and entityconnect. The other entities are built with ECK and also have updated CRUD paths.
Some other things I've noticed (might not be important)
- When I click the edit button build_cache_id is included in the query string, however when I click the add button it isn't.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | ajax-child-2646990-10.patch | 547 bytes | cgv |
| #7 | more-general-child-check-2646990-7.patch | 1.98 KB | dave bagler |
Comments
Comment #2
dave bagler commentedIt's an issue with my custom paths. In entityconnect_form_alter() on line 174 there's a check to see if it's a child form based on the position of the word 'add' in the path. Entity connect is looking for 'add' in path argument 1, but for my urls it's argument 2.
I tested by replacing arg(1) with arg(2) and the 'add' forms work as expected. So I've changed this issue category from bug to task because while it works it seems a bit rigid. @jygastaud would you be open to a patch that allowed for setting a custom 'is child' check? If so I'll get working on it.
Comment #3
jygastaud commentedHi Dave,
First, thanks to offer working on that piece.
I've already worked on something close in 7.x-2.x branch.
I've decided to completly remove controls on entity_types or any "add" for having a more generic way to deal with any kind of entities.
Did you try the 7.x-2.x branch ?
Comment #4
dave bagler commentedHi Jean-Yves,
I did try the 2.x branch but I ran into some other issues, if I was just starting now I would probably switch. For now I've just updated my custom CRUD paths so that 'add' is in the
arg(1)position and everything works fine. So rather than making a code change maybe a documentation change would be enough? I can write something up for the FAQ in the readme.Thanks for the quick reply.
Comment #5
jygastaud commentedCan you try to backport the change from 2.x to 1.x and told me if 1. it solves your issue, 2. you see any side effect ?
I think you should be able to just copy/paste the code from underlying lines in github (see previous link).
Comment #6
dave bagler commentedYeah I'll take a look.
Comment #7
dave bagler commentedI didn't have a chance to take a look at the 2.x code and back port it to 1.x. I ended up just reworking the existing if statement to make it more general and it solves my problem. I rolled it into a patch incase it is helpful for anyone else.
Comment #8
lrodarte commentedIs this supposed to be fixed in a version?
I had the 7.x-2.0-rc1 version installed, and then tried the 7.x-2.x-dev. The problem occurs in both versions.
Comment #9
dave bagler commentedThis is in the 1.x-dev release.
Comment #10
cgv commentedHi, I have a similar problem using version 7.x.2.0-rc1. When I edit the select entity in the parent form and add a field collection item in the child form and submit it. Then, I get on the view page of the child content. I fix with the attached patch.
Regards
Comment #11
jkingsnorth commentedI wonder if the patch in #3 of #2850489: Not returning to referencing form when form contains ajax file upload field might help this issue?
Comment #12
jsibley commentedI may be running into a similar issue. I am using entityform and when I click on the add button, the url is:
[mysite]admin/structure/entity-type/project_survey/project_survey/add/entityconnect-form-mP5vVhjefvU9FlXG-UA3Lx8A00aiiXI_Yu4HzXJxn40
When I click on "save", I am returned to the page that views the created entity ([entityname]/[bundlename]/[entityid]) instead of returning me to the entityform.
Just in case it helped, I tried the patch referred to in comment #11 above. It doesn't seem to make a difference.
Also, I see this in my log, which might be related:
Notice: Undefined property: Entity::$id in entityconnect_eck_entityconnect_child_form_submit_alter() (line 115 of [mysite]/sites/all/modules/entityconnect/modules/entityconnect_eck/entityconnect_eck.module).Thanks for any thoughts on this.
Comment #13
astonvictor commentedD7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.