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.
Setting the label display to "hidden" or "visually hidden" in the Contact Forms configuration does not seem to have any effect on the field label.
To reproduce:
- On a standard install
- Change the Message field label of the Feedback form to be hidden (/admin/structure/contact/manage/feedback/display)
- Go to the Feedback form at /contact/feedback
- Enter dummy title and message content and press Preview
- Notice that the Message label is visible.
Comment | File | Size | Author |
---|---|---|---|
#36 | interdiff-33-to-36.txt | 2.46 KB | claudiu.cristea |
#36 | 2756689-36.patch | 3.54 KB | claudiu.cristea |
Comments
Comment #2
alexbea CreditAttribution: alexbea commentedComment #3
pareshpatel CreditAttribution: pareshpatel as a volunteer and at Cybage Software Pvt Ltd. commentedIt seems that it's not an issue with Contact Block module. It should be the issue in Core Contact Module.
I have checked the core contact form and manage display setting for labels and it is not working.
Comment #4
Sutharsan CreditAttribution: Sutharsan commentedMoving the issue from Contact Module to Drupal core. Fault still exists on 8.3.x.
Comment #5
BerdirThat's because the message is still hardcoded in the viewbuilder and assumes it is an extra field when it is actually not.
Removing that fixes this.
Also looks like we had zero tests for preview? Which looks laughably bad, but that's another problem.
Comment #6
claudiu.cristeaI wonder why message was considered an extra field. Are there some reasons?
However...
I see below, we're using the square brackets. Let's use also here the square brackets syntax.
$form->toUrl() instead of hardcoding the path, as is the canonical path.
Extra empty line before end of method.
Comment #7
claudiu.cristeaMore...
These are looking wrong. The entity field should not be passed to
t()
.Also @klausi told me at some point that we should not use t() anymore in tests, not even for buttons, not even in simpletest. I read this somewhere but I can't find the page.
Comment #8
BerdirBecause message used to be an extra field.
Sorry for those copy paste errors, should be an easy Novice task to fix them.
Comment #9
jeevanbhushetty CreditAttribution: jeevanbhushetty at QED42 commentedComment #11
aroua_safa CreditAttribution: aroua_safa as a volunteer commentedI'm going to review it
Comment #12
aroua_safa CreditAttribution: aroua_safa as a volunteer commentedI made a review on 8.1, 2, 3 and 4.x versions and confirm that the patch work.
Comment #13
BerdirThanks for testing, but someone still needs to address #6.
Comment #14
arunkumarkHi,
As per comment #6 and #7 i have updated the patch.
Comment #15
claudiu.cristea@arunkumark, please post an interdiff
Comment #17
arunkumarkRe-rolled patch.
@claudiu.cristea can't apply the patch file contact-message-title-2756689-5.patch so the problem in the creation of the interdiff file.
Comment #18
claudiu.cristeaIn such cases, you do first a reroll, commit in a temp branch. Then you apply the changes and run a diff against that intermediary branch, so you get the interdiff.
Unrelated changes. Revert them.
And the big problem is that you removed the test from #5.
Comment #19
tameeshb CreditAttribution: tameeshb at Google Summer of Code commentedCorrected patch from #17 As recommended in #18
Comment #20
BerdirYou lost the test coverage in that reroll. Compare with the previous patches.
Comment #21
claudiu.cristea@tameeshb, as I said in #18, the patch removed the test from #5. So, please:
Thank you.
Comment #22
tameeshb CreditAttribution: tameeshb at Google Summer of Code commentedAlright, but the interdiff is to be done with which patch? #5?
Comment #23
claudiu.cristea@tameeshb, yes, please do it against #5.
Comment #24
tameeshb CreditAttribution: tameeshb at Google Summer of Code commentedPatch form #5 revised, please review! :)
Comment #25
tameeshb CreditAttribution: tameeshb at Google Summer of Code commentedMissed out on a ']' in the last patch, corrected and uploaded with interdiff against #5
Comment #28
claudiu.cristea@tameeshb, thank you.
Unrelated changes. Please revert them.
#6.2 is not addressed.
This is wrong. You should not append
$contact_form
. Only$form->toUrl()
should be passed as argument.Comment #29
tameeshb CreditAttribution: tameeshb at Google Summer of Code commentedComment #31
geertvd CreditAttribution: geertvd at XIO commentedComment #33
geertvd CreditAttribution: geertvd at XIO commentedComment #34
BerdirLooks good to me. This was originally my patch, but has been RTBC before and reviewed by others too.
Comment #36
claudiu.cristeaYes, the test is a
BrowserTestBase
now. I replaced also the deprecated assertionsComment #37
claudiu.cristeaAnd because this is a bugfix with no API implications, this should be fixed in 8.3.x.
Comment #38
BerdirAnd back to RTBC, thanks for the reroll and updates.
Comment #39
alexpottLess code. More tests. Yay.
Committed and pushed e27d0da to 8.4.x and bbbb980 to 8.3.x. Thanks!
Comment #43
kenheim CreditAttribution: kenheim commentedI'm using 8.3.2 and this is still an issue.
Comment #44
sajosh CreditAttribution: sajosh commentedField label is not getting Hidden, Visibly Hidden, nor Inline for me either.
drupal 8.4.3 upgraded from D6
PHP Version 7.1.12
Memory limit 524M
Database Version 5.5.58-0+deb7u1-log
I verified that all the changes in patch #36 are in my 8.4.3 core files.
I tested this on a clean D8 install too but field label is still only Visible.
I also tested if the field is 'not required', but alas, still only visible.
Do you want me to test anything?