Skip to content

Commit

Permalink
fix(comments): no longer add duplicate html ID in threaded comments
Browse files Browse the repository at this point in the history
fixes #14269
  • Loading branch information
jeabakker committed Jan 17, 2023
1 parent 65817a0 commit 242d9a5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions engine/lib/views.php
Expand Up @@ -893,6 +893,12 @@ function elgg_view_comments($entity, $add_comment = true, array $vars = []) {
$vars['entity'] = $entity;
$vars['show_add_form'] = $add_comment;
$vars['class'] = elgg_extract('class', $vars, "{$entity->getSubtype()}-comments");

$default_id = 'comments';
if ($entity instanceof \ElggComment) {
$default_id .= "-{$entity->guid}";
}
$vars['id'] = elgg_extract('id', $vars, $default_id);

$output = elgg_trigger_plugin_hook('comments', $entity->getType(), $vars, false);
if ($output !== false) {
Expand Down

0 comments on commit 242d9a5

Please sign in to comment.