As mentioned in #2008898: Replace Merge fields select options with standard Drupal tokens, I now took the path of adding property support to the merge field mapping. I noticed that the code for that already existed but was commented out 7.x code.
Same for referenced entities, I also updated that and also touched quite a bit of related code, which makes this a bit bigger but I think also less likely to fail in some weird way (e.g. the user bundle fix would as far as I see result in a fatal error on any non-user entity right now) and the has-changed logic now re-uses the mergevars populate helper function instead of duplicating part of the logic (which failed now with the new keys).
Tested with the name field, the address field for example now also shows up nicely. I also tested it with a referenced entity (filename of the user picture as I had nothing else at hand)
Allowing myself to make this major, with all those fixes and improvement I think this is a pretty big improvement.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | mailchimp-field-properties-2908547-5-interdiff.txt | 744 bytes | berdir |
| #5 | mailchimp-field-properties-2908547-5.patch | 12.14 KB | berdir |
| #4 | mailchimp-field-properties-2908547-3-interdiff.txt | 1.79 KB | berdir |
| #4 | mailchimp-field-properties-2908547-3.patch | 11.92 KB | berdir |
| #2 | mailchimp-field-properties-2908547-2.patch | 11.7 KB | berdir |
Comments
Comment #2
berdirComment #3
berdirComment #4
berdirFixed an error when a field with field properties when the field is empty.
Comment #5
berdirAnother small change, this forces the values we send to be strings. This was a problem for me e.g. in migrations where some users had NULL as value that was set and not an empty string. That resulted in errors like this: a:1:{i:0;O:8:"stdClass":2:{s:5:"field";s:18:"merge_fields.LNAME";s:7:"message";s:57:"Data did not match any of the schemas described in anyOf.";}}"
Not sure if the @todo is relevant or if always sending a string is fine. Probably it is.
Comment #7
ruscoe commentedThank you, Berdir. This works perfectly for me. I'll update the issues that reference this one to let people know a patch has been committed.