Score:2

How to hide the comment subject field?

kz flag

In Drupal 7, there used to be a checkbox: "Allow comment title". Unchecking that, and there was no comment title.

I am unable to locate a similar setting in Drupal 9.

I've found: How to remove or hide the Subject field for comments?

It explains how to auto-generate the subject field for a comment. This is not what I am asking. I don't want to display any subject field when showing a comment. If you're familiar with how comments work in issues posted on Drupal.org, that is the solution I am looking for.

Edit: In comments, it is suggested that you can do this by navigating to the "Manage display" tab for the comment type. However, this is a screen dump (Drupal 9.4.8) of that tab for the default comment type:

Manage display

I see no obvious way to set the title not to be shown.

cn flag
Can't you hide the subject field on the Manage Display tab?
Jaypan avatar
de flag
That's how you do it. Admin -> Structure -> Comment types -> [COMMENT TYPE] -> manage display. Set the title to not be shown.
Free Radical avatar
kz flag
@PatrickKenny, no you can't you hide the subject field on the Manage Display tab. See edited question.
Free Radical avatar
kz flag
@Jaypan see edited question.
Score:3
ua flag

A solution is to copy core's comment.html.twig and put it in your theme's /templates folder and remove the <h3{{ title_attributes }}>{{ title }}</h3> line.

Free Radical avatar
kz flag
I agree that this will work, but I really do not want to create a subtheme just to be able to hide the Subject. I would prefer to do this from the administrative GUI. The contributed extension named **Manage display** let me do that, so I've added that as a self-answer.
Score:3
kz flag

If one installs the contributed extension named Manage display the "Subject" field becomes exposed under the "Manage display" tab for a comment. You can then move it to the "Disabled" section to hide it.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.