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.
If you hide the subject widget on the comment form, or if the user does not enter a comment subject, a subject is auto-generated from the first sentence of your comment as the title. In Bartik this is displayed above the comment, which is redundant visual clutter.
Example:
--------
Hello this is a ....
Hello this is a comment!
Original report:
Only display for title comment i can hide, but for me not need title on comment form. field title i can not delete or hide.
Comments
Comment #1
BerdirYou can hide the filed in the content type settings, in the "Comment settings" vertical tab, uncheck the "Allow comment title" checkbox.
Comment #2
aspilicious CreditAttribution: aspilicious commentedBerder I ran into the same issue he has *I think*.
If you don't allow the comment title, you can't choose a title, but in Bartik when your comment is saved it takes the first sentence of your comment as the title. Very ugly. I edited Bartik so it wouldn't show the title.
Example:
--------
Hello this is a
Hello this is a comment!
Comment #3
jcisio CreditAttribution: jcisio commentedI think this should be a feature request. When the title is empty, don't create a default title.
What I do in D6 and D7 is the following:
- Use hook_form_alter() to add a
array_unshift($form['#submit'], 'mymodule_modify_comment');
- In mymodule_modify_comment(), check if
$form_state['values']['subject']
is empty then replace it with a special string, like '(empty title)'- Use hook_comment (hook_comment_view) to replace this special string to an empty string
Drupal is so powerful and flexible, but I think we need a simple option that doesn't create a default title when empty :-) Or should I make this a contrib module?
Comment #4
aspilicious CreditAttribution: aspilicious commentedWe can close this by design than...
Comment #5
jcisio CreditAttribution: jcisio commentedComment #6
jhedstromBeen a while since this was updated. Anything left to be done?
Comment #7
jonathanshawBerdir's #1 no longer applies in D8, but #2227503: Apply formatters and widgets to Comment base fields would make the visibility of the subject configurable in D8.1.
Showing/hiding the subject depending on whether it was auto-generated or not seems like a specialised use case that should be handled in contrib (or by Rules etc.), doesn't need to be in core. Especially given the drive to focus the core comments module on providing an API framework not a solution to every possible site need.
The residual issue that is appropriate for core is that the out-of-the-box appearance is ugly because the subject field (although configurable) is visible by default. I propose the solution to this is for the subject to be hidden by default on the default display mode of the default comment type
Forums have their own comment type so I suggest are out-of-scope for this issue.
(#2312329: Hide the comment "subject" field by default on this subject had converged to be a duplicate of #2227503: Apply formatters and widgets to Comment base fields, so I closed it as a duplicate, and suggest discussing the question of what should be default in this issue instead).
Comment #8
jonathanshawComment #9
jonathanshawComment #10
jonathanshaw