Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
node data
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Aug 2009 at 14:11 UTC
Updated:
25 Mar 2010 at 08:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
dawehnerI think this would have to be a prerender_list handler
Comment #2
mikeker commentedI had the same need in a project I'm working on. Attached is a patch to add Node:Path as a display field. I didn't need filters or sort functionality so I didn't add those.
I would be good to include a relative/absolute option -- I'll see if I have time to add that later. In the meantime, any help testing would be appreciated.
Comment #3
dawehnerMh this executes the function quite often. You could perhaps use pre_render method to load all path aliases at once.
Comment #4
mikeker commenteddereine, I'm not sure I understand. render() is called once per node:path field per record. Using pre_render to load all path aliases at once will make the same number of calls to drupal_get_path_alias. Wouldn't adding a pre_render() method add an additional function call to the total? Or is there some way to use pre_render to replace render()?
Thanks.
Comment #5
nevets commentedWhy not just use the "Node: Link" field?
Comment #6
mikeker commentedNode:Link gives you the whole <a> tag with no ability to edit it (eg: add a title attribute). The use case I ran into was creating having the Node:Title link to the node with a custom field in the in the title attribute.
Comment #7
nevets commentedThen you might want to consider a patch to "Node: link" that makes that possible, it seems to make more sense than another field type.
Comment #8
mikeker commentedI considered that. I thought Node:Path would be more flexible in terms of using the "Rewrite the output of this field" in other fields. Perhaps not, though.
Also, to do this in Node:Link, I'd have to add the alt text field plus enable both that and the "Text to display" field for replacement patterns. And, to put it bluntly, I've got no idea how to do that...
I can look into it if you feel strongly that this belongs in Node:Link or that adding another node field creates additional confusion.
Comment #9
ao2 commentedI am interested in this functionality too.
Comment #10
dawehnerWouldn't it be possible to write a drupal_lookup_path_multiple?
Comment #11
dawehnerThe more i think about it, i'm ok with this patch. Even for normal links to nodes, this function will be stored and cached internally
Comment #12
ao2 commentedMaybe it could be better to use
url()instead or concatenatingbase_path()directly.Comment #13
mikeker commentedI think ao2 is right. Besides it also makes it really easy to add an absolute/relative option, which I did with the attached patch.
Comment #14
allhailtheduck commentedThe patch above works beautifully, kudos and thanks.
I'm using it with Views Gallery to link the image in the gallery teaser to the gallery node itself.
Comment #15
dawehnerFor me absolute should be configurable. There are use cases for both.
Comment #16
mikeker commentedAgreed. The patch in #13 adds a checkbox for absolute paths.
Comment #17
dawehnerYeah the patch looks fine.
Comment #18
RikiB commentedWorks perfectly, I hope this gets added soon so when I update I wont have to patch again.
Comment #19
merlinofchaos commentedOk, this is +1.
However, the new handler seems to be missing an option_definition() to define the new 'absolute' setting, which will break in 3.x. This is necessary.
Comment #20
dawehnerUpdate, but still needs work.
Non-Absolute urls should be "node/123" instead of "/node/123".b
Comment #21
dawehnerOk. Its fine. You can use absolute then. Added a description to document this
Comment #22
merlinofchaos commentedCOmmitted to both branches of 6.x; doesn't apply to 7.x but this is probably an easy fix.
Comment #23
dawehnerAnd commited.