1

I'm using Drupal 7, Views 3, and Token.

I created a view of comments.

I would like added to this view a field of the parent node.

I thus added a header, of type "global text area", I tried of added a token corresponding to the desired field, clicked on "Use replacement tokens from the first row ", but it does not work (the token appears but not the field).

Have you a solution?

1

You should be able to see the parent node field suggestion in your views. One thing I doubt is parent node of comment on the top(first row) should have that field you are trying to add, as 'Use replacement tokens from the first row' will simply replace the title as per the parent node on the first row.

Adding a sample view on the same lines

View Configuration enter image description here

View Preview enter image description here

  • I tried it, but I cannot modify any more the appearance of my comments in "comment.tpl.php", because the format is "fields". When the format is "comments", even with the relationship "comment: content", I cannot reach the fields of the contents. It is possible to reach fields with for the format "comments", or to keep the template comment.tpl with the format "fields" ? – Hgfdsoiu Oct 24 '16 at 17:56
  • You need to have the parent node field as part of your views fields, only than the tokens can be replaced, so comment format will not work for you. Once you add the comment as field format in view it would not render by comment.tpl instead it will use views template file, which you can override. – arpitr Oct 24 '16 at 18:11
1

You need to add a relationship to your view on the nid. Once you do that you will have the fields from the parent node available to be added to your view.

  • I added this relationship... – Hgfdsoiu Oct 24 '16 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.