Hey there,
Contact integration is still an @todo in the code for D8. We're looking to use this for our contact for at http://lastcallmedia.com, so I patched the module to support the current state of things. Hope we can get this integrated. Thanks!
Comments
Comment #1
rbayliss commentedAnd the patch.
Comment #2
geerlingguy commentedInitial code review looks pretty good; I would really like to add tests around this (at least one, where contact module is enabled, and honeypot field shows up on the form for anonymous user), as contact forms are radically different in D8, and it would be nice to make sure no other changes I start making will break anything.
Also, did the cache tag invalidation change from using Cache to \Drupal::cache() recently? I was just working with Drupal 8.x-alpha10, and it seemed that the way that was working was correct at that point...
Thanks!
Comment #3
rbayliss commentedSorry, forgot to explain that. You're setting the cache with an ID in Drupal::cache()->set(), then try to invalidate it using cache tags. If you want to use cache tags here, you have to add them in the set() call. I discovered that when my changed settings weren't present after saving the Honeypot settings form. I can't really see a reason to use tag invalidation though, unless I'm missing something.
I'll try to get some tests in tomorrow.
Comment #4
geerlingguy commentedThanks! I haven't taken much time to look at how D8 caching works, and I don't think I've even looked at it since alpha 1, so I'm pretty sure you're correct :)
Comment #5
rbayliss commentedAlright, this time with a test. The test_only version of this patch should fail.
Comment #8
rbayliss commentedComment #9
rbayliss commentedComment #12
rbayliss commentedIf at first you don't succeed...
Comment #14
geerlingguy commentedI think you can add do-not-test on the second patch to skip it (just FYI). I'll take a look at this later; thanks!
Comment #16
geerlingguy commentedLooks great! Manually tested everything, and poked and prodded it into submission. Thanks for the great and very quick work :)
Only change I made was the string for the test success message; I updated it to 'Honeypot field is added to Contact form.'
Comment #17
rbayliss commentedGreat! Thanks for the fast turnaround.