Question

This is regarding a Drupal 8 site, specifically Drupal 8.7.1 and the "Contact" module (with Contact Emails, Contact Storage enabled).

The issue that I'm running into is some of the fields are not included in the email that's sent out when the form is submitted. No Swiftmailer or other HTML email packages involved here, my ultimate goal is just to include all fields that were filled out.

I narrowed the situation down to this - when logged in, the resultant email sent out after form submission always contains all of the correct fields. If not, or in other words an anonymous user fills out the form, some fields are missing from the email entirely.

The aforementioned missing fields are actually paragraphs, or entity revisions, that I made use of to get access to the add / remove paragraph functionality on the front end. They work great, with a bit of preprocessing, but absolutely refuse to be included in email messages when the submitter is an anonymous user.

Sanity check - The fields are all there and filled out as part of the Contact Storage module, so that's not the issue. Anonymous users obviously do not have any kind of access to administer paragraph types, but this is not needed when the paragraphs are fields in a contact form(?).

I've checked around the various stack exchanges and other sites, but I can only find vaguely relevant issues, such as Theme contact emails. Using paragraphs in Contact does not appear to be a popular thing to do. They are embedded as subforms, but I can't find anyone else who has asked this question.

The site is hosted on Acquia Cloud, PHP 7.2, if that helps. Short of digging through the module's entire codebase or setting up HTML mail with something like Swiftmailer, I'm stumped.

Any help is much appreciated, please let me know if you need any more detail on something - I know this is a lot to read without code or screenshots.

Was it helpful?

Solution

After working with JDev518 on this we discovered this was a permissions issue with paragraphs. Although this should have worked as is, we ended up installing Paragraph Type Permissions" and assigning specific permissions to create/edit/view the paragraph fields in question for anonymous. This "forced" the permission check to work and started including the submitted values in the email. However the contact module is determining the view permissions on those paragraph fields when it's building the email seems to be the cause of this issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top