Problem/Motivation
The JS logic selects the field only by name, and my understanding is that it will then as a result always pick the first.
I started making this more specific by using a more specific selector for the geolocation widget and then attempting to find the address field as a sibling first.
That part seems to work, but it doesn't yet fill out the address, there's more work to be done here.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork geolocation-3484824
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
berdirI opened a merge request against 8.x-3.x for now since that's what we're using. I think the problem also exists in 4.x, the change doesn't apply but it doesn't seem to be doing anything that would improve this.
Comment #4
berdirFound the problem, I had to use the full name as key to allow separate configurations for each.
Comment #5
christianadamski commentedCould you in more detail describe the scenario? What would I have to set up to recreate this?
Comment #6
berdirCreate a paragraph type with a geolocation + address field and a paragraph field that allows multiple values.
Imagine a company node type with multiple locations, each location is a map with address + other infos, like opening hours or so. you could kind of build that with single field and multiple values each, but if you also want to
Note that you will also run into #3480206: Geolocation Field in combination with Paragraphs (Ajax/Modal) handling when trying to do that as html_head apparently can't be added through an ajax response, so if you don't load any geolocation fields initially, it won't work. (this scenario would work I guess if you set the paragraph widget to use such a location paragraph type by default.
Comment #7
christianadamski commentedI'm at DrupalCamp Berlin. Spend whole day looking at this. Not simple.
Comment #8
christianadamski commentedThe parent form is still the node form. So I don't see an obvious way to clearly identify the matching address form element relative to the geolocation form.
Right now I think it will come done to CSS selector guessing :(
Comment #11
christianadamski commentedv4 is fixed. You opened a MR for v3. I haven't tested it. Did you extensively? Can I merge blindly?
Comment #12
berdirThe client confirmed it worked for their use case, but I didn't test it that extensively, and specifically didn't test if it still works for any other use case.
Feel free to leave it at needs review for others to confirm or just only fix it for 4.x, your call.
Comment #13
christianadamski commentedv4 I already merged (and released) separately.
Hmm. Ok, I'll see if I get around to testing v3.
Comment #14
nicross-com commentedI did not test thoroughly, but MR!85 applies for me in v8.x-3.14, and it fixes this issue in my project. Thanks!