Description of the need

The default situation in Backdrop CMS for comments is to display a title on all comments. If the user does not have the ability to manually create a custom title for the comment (this is an optional setting), then Backdrop CMS simply takes the first part of the first line and generates a title for the comment.

This latter functionality doesn't seem very helpful to me. I believe that it should be possible to turn off the title on a comment field.

Proposed solutions

We are currently discussing two different approaches towards resolving this issue and have two different PRs.

4569-1 -- CSS Solution

This solution primarily relies on CSS and works pretty well with most core AND contrib themes (but not perfectly).

  • Update hook to replaces old comment_subject_field boolean setting with comment_title_options setting (3 choices - auto, custom, hidden)
  • If "Hide Titles" is selected, a css class hide-comment-titles is added to the comment titles, it uses CSS to hide comment titles on any theme that is displaying comment titles and replaces them with a SVG "link" icon that acts as a permalink.
  • To accomplish css change in all contrib themes this PR adds a new css file at: core/modules/comment/css/comment_titles.css

4569-2 -- Template Solution

This solution updates the comment.tpl.php files for core, Bartik, and Basis and works with any contrib themes that inherit those templates/css. BUT, sites that use contrib templates that override comment.tpl.php files would not be able to hide comment titles unless their contrib theme is updated.

  • Update hook to replaces old comment_subject_field boolean setting with comment_title_options setting (3 choices - auto, custom, hidden)
  • If hidden is selected, it uses the comment.tpl.php file to hide the comment title in core, basis, and bartik.
  • It does not have any effect on contrib themes using custom comment.tpl.php or comment.css files. Users will be unable to hide titles on those themes, unless the theme updates to support this feature.
  • In BASIS, it uses CSS to add a permalink icon when the titles are hidden (see below).
  • In core and Bartik, it keeps the same old permalink link that was there by default.

Issues to Consider

  • By default comment titles also serve as a permalink. Simply hiding comment titles might leave some sites without any permalinks available for comments. Some core and contrib themes provide separate permalinks and this would not be a problem.
  • Because many contrib themes override the core comment.tpl.php and comment.css files, the first option above creates a NEW css file to make sure this solution works with as many contrib themes as possible.

Additional information

See my comment in #4413

I am working on the website for Backdrop CMS Live event and I am running into this problem and it seems REALLY weird.

-1) "Allow comment title" is turned off (I see the point, that this might just be mislabeled). -2) My comments are all being auto populated by a title, which is really just the first line of text from the comment, formatted as a link which really does nothing but take me to the comment I'm already on.

This title and/or link looks really weird and doesn't serve any purpose that I can imagine. Also, I can't find anyway to hide this in the UI.

My screen shot comes from a default installation of Backdrop CMS with no changes to config, except enabling comments on this specific node and adding some comments.


To Do

  • [ ] Decide if we should also add a new variable for permalink path.

Next Steps

The next step for this issue is to decide on the best approach (see options discussed above).

Once we decide on an approach, we can work on the details of either PR and address issues with tests.

GitHub Issue #: