if ($build[$id]['#comment_threaded'
]) { // The final comment must close up some hanging divs.
$build[$id]['#comment_indent_final'
] =
$current_indent;
} } /**
* {@inheritdoc}
*/
protected function alterBuild(array &
$build, EntityInterface
$comment, EntityViewDisplayInterface
$display,
$view_mode) { parent::
alterBuild($build,
$comment,
$display,
$view_mode);
if (empty($comment->in_preview
)) { $prefix = '';
// Add indentation div or close open divs as needed.
if ($build['#comment_threaded'
]) { $prefix .=
$build['#comment_indent'
] <= 0 ?
str_repeat('</div>',
abs($build['#comment_indent'
])) : "\n" . '<div class="indented">';
} $build['#prefix'
] =
$prefix;
// Close all open divs.