diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index ad82046..c2a2ae6 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -613,6 +613,7 @@ function template_preprocess_comment(&$variables) { $commented_entity = $comment->getCommentedEntity(); $variables['comment'] = $comment; $variables['commented_entity'] = $commented_entity; + $variables['threaded'] = $variables['elements']['#comment_threaded']; $account = $comment->getOwner(); $username = array( diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig index 3a7d19b..31b82e2 100644 --- a/core/modules/comment/templates/comment.html.twig +++ b/core/modules/comment/templates/comment.html.twig @@ -41,6 +41,7 @@ * - content_attributes: List of classes for the styling of the comment content. * - title_attributes: Same as attributes, except applied to the main title * tag that appears in the template. + * - threaded: A flag indicating whether the comments are threaded or not. * * These variables are provided to give context about the parent comment (if * any): diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig index 31b9a77..2dac831 100644 --- a/core/themes/bartik/templates/comment.html.twig +++ b/core/themes/bartik/templates/comment.html.twig @@ -41,6 +41,7 @@ * - title_attributes: Same as attributes, except applied to the main title * tag that appears in the template. * - content_attributes: List of classes for the styling of the comment content. + * - threaded: A flag indicating whether the comments are threaded or not. * * These variables are provided to give context about the parent comment (if * any): @@ -63,7 +64,9 @@ * @see template_preprocess_comment() */ #} -{{ attach_library('classy/drupal.comment.threaded') }} +{% if threaded %} + {{ attach_library('classy/drupal.comment.threaded') }} +{% endif %} {% set classes = [ 'comment', diff --git a/core/themes/classy/templates/content/comment.html.twig b/core/themes/classy/templates/content/comment.html.twig index 1decd44..bb06364 100644 --- a/core/themes/classy/templates/content/comment.html.twig +++ b/core/themes/classy/templates/content/comment.html.twig @@ -41,6 +41,7 @@ * - content_attributes: List of classes for the styling of the comment content. * - title_attributes: Same as attributes, except applied to the main title * tag that appears in the template. + * - threaded: A flag indicating whether the comments are threaded or not. * * These variables are provided to give context about the parent comment (if * any): @@ -63,7 +64,9 @@ * @see template_preprocess_comment() */ #} -{{ attach_library('classy/drupal.comment.threaded') }} +{% if threaded %} + {{ attach_library('classy/drupal.comment.threaded') }} +{% endif %} {% set classes = [ 'comment',