logo

Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Hide the comment field

12/07/2025, by Ivan
Forums

Good day!

I need to hide a specific comment field from all users except the node author.

The idea is as follows: User1 creates a certain content type Article, and a separate comment type with a set of fields is created for this content type. Other users write comments on this content, filling in several fields. When viewing comments on the content created by User1, only User1 sees all the comment fields, while the other users see all fields except "field_example".

I overrode the comment.html.twig template.

I'm trying to add this condition:

{% if node.author_name = user.username %}
  {{ content }}
  {% else %}
  {{ content|without('field_example') }}
  {% endif %}

But it throws an error.

Please advise what I’m doing wrong!

Thanks a lot in advance!