- Issue created by @mikko123
- 🇮🇳India rksyravi New Delhi, 🇮🇳
Hey @mikko123
No option is available in Drupal Core to hide comment titles, but you can achieve this.
1. Easy way: Rewrite
comment.html.twig
file and comment the below code.{% if title %} {{ title_prefix }} <h3{{ title_attributes }}>{{ title }}</h3> {{ title_suffix }} {% endif %}
2. Write the custom
fieldFormatter
file, write the logic as needed and update. - 🇮🇳India sidharth_soman Bangalore
Here's a patch for the first method.
I'm working on introducing a settings type config for this too. I'll update if I have any success. - Status changed to Closed: works as designed
about 1 year ago 9:08am 27 December 2023 - 🇮🇳India prashant.c Dharamshala
@mikko123
When you hide a field on the "Manage form display" page, it will be excluded from the create/edit forms of the corresponding entity. This action is not associated with "Manage display."
The rendering of the field is contingent on the chosen field formatter, and users have the option to create their own field formatter.
For those who wish to modify the output without creating a new formatter, the
hook_preprocess_HOOK
function can be utilized. More information can be found at: hook_preprocess_HOOK documentation
For instance, if the HOOK is "comment," and "custom" represents the custom module's name:/** * Implements hook_preprocess_HOOK(). */ function custom_preprocess_comment(&$variables) { unset($variables["title"]); }
This should address the current issue. If there are any concerns or if something has been overlooked, please feel free to reopen the issue.
Thank you!