Views comment form missing when using replacement pattern

Created on 14 December 2020, over 4 years ago
Updated 18 March 2025, 28 days ago

Problem/Motivation

The comment form does not display when using the {{ comment }} replacement pattern in a view.

When using the Content: Comments field, it shows the list of comments and the comment form at the bottom. However, when hiding the field and using it in a replacement pattern via {{ comment }} the comment form disappears and only the comment list remain.

I feel like this is a bug because the replacement pattern with no customizations should display the same as the original version of the field.

Steps to reproduce

  1. Create a node and add new comments to the node
  2. Create a view of Content, display fields
  3. Add Content: Comments field (check the comment form is displayed in the view)
  4. Exclude Content: Comments from display
  5. Add Global: Custom Text field, enter in the text field {{ comment }} from the available replacement pattern

Screenshot

🐛 Bug report
Status

Needs review

Version

11.0 🔥

Component

views_ui.module

Created by

🇨🇦Canada chrisck BC, Canada

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India Ishani Patel

    Hello @chrisck,
    I've followed the steps as you mentioned above,
    Added a comment replacement pattern in the custom text field and replicated the issue.
    The reason is that Drupal handles the comment form separately from the comment list. When we use the {{ comment }} pattern, it only renders the list of comments as markup, but the form itself is no longer part of the rendered output.

    So I've one solution for that we can use the Rendered Entity Field in view
    Instead of using the {{ comment }} replacement pattern, do the following:

    1) Add the "Rendered entity" field to your view.
    2) Select the "Comment" entity with the "Default" view mode.
    3) This will render both:
    The list of comments.
    The comment form.

    Please check the attachment.
    Thanks.

  • 🇮🇳India sdhruvi5142

    Hi @ishani patel @chrisck

    I totally agree with the Ishani patel solution and it look feasible. As by adding following steps shared by ishani solve the problem of comment form display and its listing also. Sharing screenshots for reference. So moving this ticket to RTBC+1

  • 🇫🇷France nod_ Lille
Production build 0.71.5 2024