API page: https://api.drupal.org/api/drupal/core%21modules%21comment%21templates%2...

These variables are provided to give context about the parent comment (if any):

comment_parent: Full parent comment entity (if any).
parent_author: Equivalent to author for the parent comment.
parent_created: Equivalent to created for the parent comment.

There is comment_parent variable in comment.html.twig documentation which gives NULL result.

parent_comment provides comment entity so I think it is just documentation issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nno created an issue. See original summary.

jpoesen’s picture

Assigned: Unassigned » jpoesen
Status: Active » Needs review
FileSize
689 bytes

Indeed. In the doc block, comment_parent needs to be changed to parent_comment.

Patch provided.

jpoesen’s picture

Assigned: jpoesen » Unassigned

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

idebr’s picture

Title: Wrong variable name comment_parent in comment.html.twig » Variable comment_parent in comment.html.twig should be parent_comment
Status: Needs review » Needs work
Issue tags: +Novice

@jpoesen Thanks for creating a patch!

The comment.html.twig file is copied to several themes, so these files have to be updated as well:

  • core/themes/bartik/templates/comment.html.twig
  • core/themes/classy/templates/content/comment.html.twig
  • core/themes/stable/templates/content/comment.html.twig
johnny_aroza’s picture

Status: Needs work » Needs review
FileSize
2.7 KB

@idebr
i have made the requested changes.

idebr’s picture

Status: Needs review » Needs work

#6 @johnny Thanks for working on this issue!

+++ b/core/themes/bartik/templates/comment.html.twig
@@ -46,6 +46,7 @@
  * - comment_parent: Full parent comment entity (if any).
+ * - parent_comment: Full parent comment entity (if any).

+++ b/core/themes/classy/templates/content/comment.html.twig
@@ -46,6 +46,7 @@
  * - comment_parent: Full parent comment entity (if any).
+ * - parent_comment: Full parent comment entity (if any).

+++ b/core/themes/stable/templates/content/comment.html.twig
@@ -46,6 +46,7 @@
  * - comment_parent: Full parent comment entity (if any).
+ * - parent_comment: Full parent comment entity (if any).

The reference to 'comment_parent' should be updated to say 'parent_comment'.

In your patch, the comment is added instead.

MeenakshiG’s picture

Status: Needs work » Needs review
FileSize
2.73 KB

@idebr The reference to 'comment_parent' is updated to 'parent_comment'.

idebr’s picture

Status: Needs review » Reviewed & tested by the community

Did a scan in the Drupal core files to ensure there are no more incorrect references to the comment_parent. All occurrences have been replaced correctly in the patch in #8, so setting to RTBC!

  • catch committed 3b0682e on 8.7.x
    Issue #2945513 by jpoesen, johnnny, Meenakshi.g, idebr, nno: Variable...
catch’s picture

Version: 8.7.x-dev » 8.6.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.7.x and cherry-picked to 8.6.x. Thanks!

  • catch committed 6b70114 on 8.6.x
    Issue #2945513 by jpoesen, johnnny, Meenakshi.g, idebr, nno: Variable...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.