- Issue created by @ericgsmith
- 🇳🇿New Zealand ericgsmith
Added a quick proof of concept to show the idea on 8.x-3.x branch - but I see the 5.x branch is quite different for the token field form - haven't investigated the 5.x branch since we are still on the 3.x branch for the project we need this for.
- 🇧🇪Belgium swentel
You can completely ignore the 5.0.x branch, everything still happens on 8.x-3.x :)
- Status changed to Needs review
8 months ago 10:52pm 9 September 2024 - 🇳🇿New Zealand ericgsmith
Thanks @swentel - I should have read the module page first!
I have tidied up the MR and added tests to demonstrate what I am hoping to achieve here.
- 🇧🇪Belgium swentel
Sorry for the delay, but patch looks fine, and with tests, always good!
However, I wonder, without testing myself though, whether we could change the existing logic: instead of calling replace with 'clear' => TRUE the first time, use FALSE there and then add the logic checking whether it's empty or having the same content. That way, the replace call only happens once. If, and only if, that works, we don't even need the 'hide_if_no_tokens_replaced' option at all.
Also, looking at the follow up comments in 🐛 Hide Token Field when the value data is empty Fixed - it looks like adding a trim($value) would be useful too to be really sure.
Thoughts?