diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 103c5c8..478dad1 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1411,28 +1411,9 @@ function template_preprocess_comment(&$variables) { $variables['status'] = $comment->isPublished() ? 'published' : 'unpublished'; } - // Gather comment classes. - $variables['attributes']['class'][] = 'comment'; - // 'published' class is not needed, it is either 'preview' or 'unpublished'. - if ($variables['status'] != 'published') { - $variables['attributes']['class'][] = $variables['status']; - } - if (!$comment->getOwnerId()) { - $variables['attributes']['class'][] = 'by-anonymous'; - } - else { - // @todo Use $entity->getAuthorId() after https://drupal.org/node/2078387 - if ($commented_entity instanceof EntityOwnerInterface && $comment->getOwnerId() == $commented_entity->getOwnerId()) { - $variables['attributes']['class'][] = 'by-' . $commented_entity->getEntityTypeId() . '-author'; - } - } - // Add clearfix class. - $variables['attributes']['class'][] = 'clearfix'; - // Add comment author user ID. Necessary for the comment-by-viewer library. $variables['attributes']['data-comment-user-id'] = $comment->getOwnerId(); - $variables['content_attributes']['class'][] = 'content'; } /** @@ -1453,11 +1434,6 @@ function template_preprocess_comment_wrapper(&$variables) { // The comment form is optional and may not exist. $variables['content'] += array('comment_form' => array()); - $variables['attributes']['id'] = 'comments'; - - // Add a comment wrapper class. - $variables['attributes']['class'][] = 'comment-wrapper'; - // Create separate variables for the comments and comment form. $variables['comments'] = $variables['content']['comments']; $variables['form'] = $variables['content']['comment_form']; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php index 8c2df9b..bbca55e 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php @@ -93,24 +93,6 @@ function testCommentClasses() { // Verify classes if the comment is visible for the current user. if ($case['comment_status'] == CommentInterface::PUBLISHED || $case['user'] == 'admin') { - // Verify the by-anonymous class. - $comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "by-anonymous")]'); - if ($case['comment_uid'] == 0) { - $this->assertTrue(count($comments) == 1, 'by-anonymous class found.'); - } - else { - $this->assertFalse(count($comments), 'by-anonymous class not found.'); - } - - // Verify the by-node-author class. - $comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "by-node-author")]'); - if ($case['comment_uid'] > 0 && $case['comment_uid'] == $case['node_uid']) { - $this->assertTrue(count($comments) == 1, 'by-node-author class found.'); - } - else { - $this->assertFalse(count($comments), 'by-node-author class not found.'); - } - // Verify the data-comment-user-id attribute, which is used by the // drupal.comment-by-viewer library to add a by-viewer when the current // user (the viewer) was the author of the comment. We do this in Java- diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php index 1de62da..152e2ed 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php @@ -71,7 +71,7 @@ function testCommentPreview() { $this->assertLink($test_signature); // Check that the user picture is displayed. - $this->assertFieldByXPath("//article[contains(@class, 'preview')]//div[contains(@class, 'user-picture')]//img", NULL, 'User picture displayed.'); + $this->assertFieldByXPath("//article//div[contains(@class, 'user-picture')]//img", NULL, 'User picture displayed.'); } /** diff --git a/core/modules/comment/templates/comment-wrapper.html.twig b/core/modules/comment/templates/comment-wrapper.html.twig index b19c051..32661a2 100644 --- a/core/modules/comment/templates/comment-wrapper.html.twig +++ b/core/modules/comment/templates/comment-wrapper.html.twig @@ -35,17 +35,17 @@ * @ingroup themeable */ #} - +
{% if comments and (entity.entityType != 'node' or entity.bundle != 'forum') %} {{ title_prefix }} -

{{ 'Comments'|t }}

+

{% trans %}Comments{% endtrans %}

{{ title_suffix }} {% endif %} {{ comments }} {% if form %} -

{{ 'Add new comment'|t }}

+

{% trans %}Add new comment{% endtrans %}

{{ form }} {% endif %} diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig index 5fca73b..3a7d1a4 100644 --- a/core/modules/comment/templates/comment.html.twig +++ b/core/modules/comment/templates/comment.html.twig @@ -64,7 +64,11 @@ * @ingroup themeable */ #} - +{% set cssclass %} +comment comment--status-{{ status }} +{% endset %} + +
{{ title_prefix }} {#