Closed (fixed)
Project:
Links Package
Version:
master
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
6 Mar 2006 at 08:28 UTC
Updated:
4 Aug 2006 at 01:15 UTC
Jump to comment: Most recent file
attached is a handy little include file that adds views support to the links module. Display link title, link url (clickable as url, title, or the word [link]), and link clickthroughs in any view.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | links_views.inc_0.patch | 3.83 KB | eaton |
| #8 | links_views.inc.patch | 3.2 KB | eaton |
| #4 | links_views_0.inc | 2.58 KB | eaton |
| #1 | links.module_views.patch | 543 bytes | eaton |
| links_views.inc | 2.35 KB | eaton |
Comments
Comment #1
eaton commentedAnnnnnd the patch to links.module that includes it if views.module is installed.
Comment #2
RayZ commentedMostly looks good, though I have one problem. I created a few weblink nodes and set up a view that is filtered by node type = weblink with each of the 3 link fields displayed in a table. The problem is that it is not listing the link titles. Apparently, it's looking for the link_title field in the links_node table (empty in my case) instead of the links table.
Comment #3
jvandervort commented+1 for this feature request.
Comment #4
eaton commentedThis version of links_views.inc corrects the issue with display of local and global link titles. Since the population of each field depends on a given site, there are now three handlers for the link_url: display as URL, display as local title, and display as global title. Should take care of your problem with the blank titles.
Comment #5
eaton commentedComment #6
syscrusher commentedI've committed the initial version of links_views.inc, and the small modification to links.module, into CVS tonight. Overall it looks nice, but there are a couple of things I'd like to open for discussion.
First, I don't think local vs. global link titles really belong as separate fields, and I've held off committing the "_0" version of the new .inc file for now. The way these fields work in the Links Package itself is that the global title is used if the local title is absent and ignored if the local title is present. I believe we should make the views support respect this behavior. However, I'm not a wizard with Views, so I wanted to throw this topic up to you for discussion rather than making a unilateral decision. Where does the $data parameter for your functions come from? How are the entries from the {links} and {links_node} tables being obtained in Views? We probably should be offering just the link title field and letting links.inc sort out *which* title to expose for any given node.
Second, there is some oddness (to my untrained eye) in the handling of nodes with multiple links. How were you intending this to behave? I am seeing separate entries in the view for each link of each node. Is that what you wanted...that the view behaves as if it is showing the link listing and the nodes are just (conceptually) containers for the links, when these fields are used? That is a perfectly reasonable (and probably useful) way to do things, but I want to make sure it is a decision and not an accident. :-)
Eaton, I'd welcome commentary from you and RayZ about the conceptual behavior of what you want to accomplish. In the meantime, I thank you for the contrib and have posted almost all of your code into CVS. There is no question in my mind that we want this feature -- I'm not meaning to criticize your work in any way. I just want to better understand the design of your code and how it fits into the rest of the Links Package.
Thanks again for the contrib!
Scott
Comment #7
eaton commentedSyscrusher, thanks for the response. I definitely see your point about local vs. global link titles. Your method (display the local title if it's available and the global title if it's not) should be very easy to implement. I can make that change this evening.
Regarding the multiple-line-items-per-node, that behavior was intentional. Each link is a separate record, at Views.module demonstrates the same kind of behaviour with taxonomy or amazon-node driven views, all of which can have multiple records associated with a node. For normal use of the weblinks.module, though, most users will never encounter the issue, and it will allow them to create 'slice and dice' browsable weblink archives via views.module.
Additional benefits of having each link treated separately (rather than concantenated together into a single field):
Listing ALL the links associated with a node in one field (as one might want to do in a node listing) is possible with the views module, but if it's done, I think it would probably be best to put that in a separate field as far as views is concerned. 'All associated links', or something like that.
Obviously, I could be wrong ;) But that's what I had in mind when I put the .inc together.
Comment #8
eaton commentedHere's a patch that changes the field behavior: now, there's a single 'Link title' field that displays the local title if it's available, and the global title if there's no local one. The handlers have been changed a bit, so that link titles can be shown as clickable links or plain text.
It's not ready for prime time, but below is an example of the sort of stuff that's possible with it: this view definition shows all the attached links for a node in a separate tab, rather than below the body of the node.
Comment #9
eaton commentedEhhhh, here's a patch with a few typos and some terminology cleaned up (always use 'link' instead of 'weblink,' etc.)
Comment #10
jvandervort commentedAny news on a CVS update for this patch?
+2
Comment #11
syscrusher commentedGood evening, all! This is now committed to CVS. I did a brief test, and all seems well, but please retest your specific use-cases at your convenience.
Thanks for the contribs, folks!
Syscrusher
Comment #12
RayZ commentedSince this is now in CVS, I suppose this can be marked as fixed and new issues can be created as they come up (such as http://drupal.org/node/74763).
Comment #13
(not verified) commented