Views integration for comment links
Owen Barton - March 3, 2009 - 01:02
| Project: | Talk |
| Version: | 5.x-1.3 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
So if you have added comment fields pointing to nodes with talk pages you will have noticed that they go to the main node page, rather than the comment page - which is pretty confusing, especially when you are clicking on a "new" comments link.
This patch fixes this by adding 2 additional comment field handlers that have correct handling for talk pages. Alternatively we could override the existing handlers, but I figured that that could cause problems if other modules happen to be doing the same thing. This is a Drupal 5.x patch, since that is what I needed, but the same approach should would fine with Drupal 6.x views too.
| Attachment | Size |
|---|---|
| views.patch | 2.53 KB |

#1
Any chance you could update this for 6.x views?
#2
Any chance of making this work for Drupal 6.x/Views 2?
Additionally is there any other methods of fixing this issue and rewriting the links from the Recent Comments block to the correct comment location in the Talk tab?
-backdrifting
#3
You know, the way that Views 6.x-2.x works with the token rewriting stuff you can do most of this already by rewriting the output of the field... That's true as long as the content types in the view you are using all have talk enabled.
#4
True, but what to do with forum topics? I would not want to have a talk page for it.
Also, having added a [nid]/talk link to the proper field, how to specify the comment's anchor?
#5
To rewrite the field in Views 2.x did you just click on the rewrite checkbox for the comment title field and then just paste your token into the text box? So you added this:
[nid]/talk
Is that correct?
=backdrifting
#6
Hmmm ... I added this [nid]/talk to the comment title field in the text rewrite box but it's not working. Can anyone send instructions on how to rewrite the comments URLs to the Talk enabled ones using Views 2? What do I put into the Text box (under Rewrite output of this URL) and then what goes into the Link Path field?
-backdrifting
#7
I used "[nid]/talk" as an example, it really depends if you are using Pathauto, and how it is setup.
Anyway, I have to postpone using Talk, until I can also add the proper anchor to a given comment.
#8
The anchor is #comment-[cid]
#9
Wonderful. Thank you very much.
#10
vasudev - can you give a specific example of how you did this in Views? Can you send me a screenshot of your exact configuration in Views - how you did the actual rewrite using Tokens?
Thanks in advance.
-backdrifting