Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Until a recent commit, submitting a contact form would display a "Your message has been sent." message to the user. This message is now configurable when creating/editing a contact form but, by default, no message is shown/set. As discussed in #2780763: Add missing parameter in ContactFormCloneForm::__construct(), we think that this is a UX regression and that the "Your message has been sent." message should be shown/set by default.
Comment | File | Size | Author |
---|---|---|---|
#12 | contact_form_submission-2786085-12.patch | 1.63 KB | hussainweb |
#9 | contact_form_submission-2786085-8-tests-only.patch | 621 bytes | hussainweb |
Comments
Comment #2
BerdirThis is actually a follow-up of #306662: Add redirect option to site-wide contact forms. thanks for creating.
Comment #3
hussainwebHere is an attempt at this. This means that the message can never be blank, which kind of makes sense. The default message will be shown even if it is blank in the contact form settings.
Comment #4
BerdirI think not having a message is fine.
I wouldn't add a fallback there, just in the settings form. For a new form, set this value. if it is an existing form that has no value, then that is fine.
Comment #5
alexpottI agree with @Berdir
Comment #6
hussainwebYes, when I actually saw the UI, the description said 'Leave blank for no message'. So, updating the patch to write to the form instead.
Comment #7
alexpottLet's add some test coverage for this.
Comment #9
hussainwebI don't think the tests are particularly of high value but here goes.
Comment #12
hussainwebThis should fix the tests.
Comment #13
andypostThere will be always default for new forms, so "Leave blank" is wrong
Comment #14
hussainweb@andypost,
Are you sure about that? See this snippet of code:
So, it is possible for the message to be blank. I don't see anything in the save logic to set the message to a default value.
Comment #15
BerdirI would suggest we change \Drupal\contact\Tests\ContactSitewideTest::addContactForm() do make the message default NULL and only add it to $edit if one is provided ('' needs to be a valid, explicitly empty string). That should give us more test coverage of this as well.
Also, I suggest you put it in ContactSitewideTest, this is specifically to being able to store messages.
And #14 is correct, but it would be good to have explicit test coverage for that if we don't have it yet.