Problem/Motivation

As described in #2716773: [Meta] Convert 7.x-6.x Twig components to be Drupal 8-compatible, we need to convert the comment component from Zen 7.x-6.x to be compatible with Drupal 8.

Proposed resolution

The parent issue describes the general solution we need to use when converting a component.

We will need a comment.html.twig file and remove remains of comment-wrapper cos core one is great.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JimSmith created an issue. See original summary.

JimSmith’s picture

Status: Active » Needs work
FileSize
6.52 KB

Here is a patch that provides a start. At this point it is incomplete and is throwing an error during Gulp compilation.

Error parsing twig template comment.twig:
TwigException: Expected end of array.
JimSmith’s picture

Assigned: JimSmith » Unassigned

I may be too tied up to work on this for now so I'm unassigning myself. If I can free up some time I will pick it up again or take another task. I just don't want to be a roadblock.

JohnAlbin’s picture

Assigned: Unassigned » JohnAlbin

I'm starting on this now.

andriyun’s picture

Assigned: JohnAlbin » andriyun

I'm going to continue work with this issue after 5 months of silence :)

andriyun’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
7.4 KB
HOG’s picture

FileSize
223.59 KB

Patch work ok for me.

+1 to RTBC

andypost’s picture

Looks mostly clean and "core way" but this prevents to manage title within {{content}}

+++ b/STARTERKIT/components/components/comment/comment.twig
@@ -1,15 +1,53 @@
+    {{ user_picture }}
+    <p class="comment__submitted">{{ submitted }}</p>
...
+    {% if parent %}
+      <p class="parent visually-hidden">{{ parent }}</p>
+    {% endif %}
...
+    {{ permalink }}
...
+    {% if title %}
...
+      <h3{{ title_attributes }}>{{ title }}</h3>
...
+    {% endif %}

user picture is optional as well as submitted

Also it makes sense to find consensus on "rearrange" that users can make with field_ui manage display!

andriyun’s picture

Thank you for review.

@Andy I have used template from Classy core theme.
So we have the same abilities like we had now.

If you want add smth or improve need a bit more then few string in review comment.
Please elaborate your idea or propose more extended patch.

andypost’s picture

FileSize
3.45 KB
10.86 KB

First of all - kill remains of d7 for comment
Todo - convert comment wrapper to finished with component, ref #1962846: Use field instance name for header of comment list, drop comment-wrapper template

andypost’s picture

wrapper could be used from core

+++ /dev/null
@@ -1,52 +0,0 @@
-    <?php if ($unpublished): ?>
-      <mark class="watermark"><?php print t('Unpublished'); ?></mark>
-    <?php elseif ($preview): ?>
-      <mark class="watermark"><?php print t('Preview'); ?></mark>
-    <?php endif; ?>

looks watermark should be used because there's such component in
/STARTERKIT/components/components/watermark/watermark.twig

andriyun’s picture

Status: Needs review » Needs work