Problem/Motivation

When referenced in an entity reference field, the ContactForm entity has no 'rendered entity' output.

Proposed resolution

Add the view builder from Contact storage module to core.
Set this in the annotation for the ContactForm entity.
Add test coverage to verify that forms can be referenced from entity reference fields and doing so renders the message form.

Remaining tasks

All of the above

User interface changes

None

API changes

None

Data model changes

None

Comments

larowlan created an issue. See original summary.

zserno’s picture

Title: Add view builder for contact modules ContactForm entity » Add view builder for contact module's ContactForm entity
Status: Active » Needs review
StatusFileSize
new8.77 KB

First stab at this.

zserno’s picture

+++ b/core/modules/contact/src/Tests/ContactViewBuilderTest.php
@@ -0,0 +1,134 @@
+    entity_get_display('node', 'article', 'default')

Minor code cleanup needed to use variables from above instead of hard coded values.

Attached patch does this.

zserno’s picture

Meh...patch file got lost somewhere in the tubes...attached now.

balagan’s picture

Assigned: Unassigned » balagan
balagan’s picture

StatusFileSize
new9.43 KB
new2.6 KB

The previous patch used methods that are gonna be deprecated, I changed them for the new ones.

balagan’s picture

Assigned: balagan » Unassigned
balagan’s picture

I forgot to mention, but except for the deprecated methods everything was fine, I could select Rendered entity as the display format, and the contact form displayed properly rendered in the containing content type.

Status: Needs review » Needs work

The last submitted patch, 6: add_view_builder_for_contact-2750633-5.patch, failed testing.

balagan’s picture

StatusFileSize
new8.78 KB
new2.39 KB

Ok, I have changed the patch to load entity_view_display and entity_form_display from storage.

balagan’s picture

Status: Needs work » Needs review
andypost’s picture

Issue tags: +Needs change record

Looks great, there's only 2 weeks before beta

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

berdir’s picture

Status: Needs review » Needs work

What about using this in \Drupal\contact\Controller\ContactController::contactSitePage or even replacing it completely at least for the route with an explicit contact form? Then we could change that method to only care about the case for showing the default.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

rgpublic’s picture

Hmm. Any progress on getting this into the main contact module? I really think that the rendering of a contact form shouldnt rely on the contact storage module. First, it's totally unexpected. Second, I don't want to store any form data. It's not even allowed under the new EU GDPR law.

berdir’s picture

You're welcome to work on it :)

> Second, I don't want to store any form data. It's not even allowed under the new EU GDPR law.

I'ts not that simple, actually. GDPR does not prevent you from storing the data, just that you explain what you are doing with that data, that you keep it save and control who can what with that data.

Which is actually much easier to do *if* you store in on your secure and protected Drupal site as opposed to sending that personal data around in unprotected e-mails.

rgpublic’s picture

Yes, Berdir, you are right of course. I took a shortcut in my explanation. But: If a customer wants to get a mail with all information sent e.g. via a contact form it is much better for us (as an IT provider) from a legal POV if we don't have a copy of that mail anymore. That's what I tried to convey :-) Nevertheless, I think this connection between the contact storage module and the bare necessity of being able to render a form is really strange and should be abandoned.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

The Contact Module was approved for removal in #3476879: [Policy] Move Contact module to contrib.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3520460: [meta] Tasks to deprecate the Contact module and the removal work in #3520466: [meta] Tasks to remove Contact module.

Contact will be moved to a contributed project after the Drupal 12.x branch is open.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

andypost’s picture

Project: Drupal core » Contact
Version: main » 1.x-dev
Component: contact.module » Code
Status: Postponed » Needs work