Problem/Motivation
Sometimes you want to temporarily prevent contact form submissions
At present you can only do that by deleting it, which is painful
Proposed resolution
Add ability to disable a form by adding a 'status' flag to contact form entity
Add a disabled message to allow custom message when disabled
Add schema changes
Add update hook to set default value to true
Add enable and disable forms for the entity
Add these to the entity annotation
Add routing
Add entity operation to do so
Change view builder for contact form (#2750633: Add view builder for contact module's ContactForm entity) to render disabled message if disabled
Change add form for message entity to render disabled message if disabled
Test coverage
Remaining tasks
All of the above
Much of this can be borrowed from functionality in contact storage - see #2724499: Allow disabling forms to prevent new submissions
User interface changes
New 'disabled message' field on contact form
New disable/enable forms
New entity operations for disable/enable
API changes
None
Data model changes
New properties
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | add_option_to_disable-2750649-1.patch | 26.35 KB | claudiu.cristea |
Comments
Comment #2
claudiu.cristeaLet me try this.
Comment #3
claudiu.cristea@larowlan, I'm not sure that the message should be the only option. 404 can be considered too. So, probably, we need a new entity field for that as we'll use the native 'status' switch from the config entities. I'm proposing the next schema:
EDIT: Changed 'mode' to 'behavior' and its type from integer to string.
Comment #4
claudiu.cristeaComment #14
hongpong commentedCan we re-up this? it would be really helpful to toggle off contact forms sometimes.
Comment #21
quietone commentedThe 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.
Comment #23
andypost