1. If a Node:Link token is used for "Output this field as a link", then no matter what you put in for "Link path: ", you only get the original link.
2. if you have some string like "#comment-form" in the "Link path:", the the char "#" is converted to "%23", which breaks the bookmark to the comment-form.

CommentFileSizeAuthor
#7 views-n465986.patch1.54 KBdamienmckenna

Comments

damienmckenna’s picture

Version: 6.x-2.5 » 6.x-2.6

I'm experiencing the first bug with 2.6, any time I add [view_node] as the link string the link is inserted as: base_path() . 'view'

damienmckenna’s picture

The reason is that Node:Link creates a link in the format (pseudocode):

print '<a href="' . url('node/' . $node->nid) . '">' . $link_string . '</a>';

with the default $link_string being just the word "link".

So, when you want to wrap that as a link around something else, the code is parsing the string for plaintext, presumably using strip_tags() or equivalent, which results in the single word "link".

Ta-daa!

Now to fix it.

damienmckenna’s picture

Status: Active » Closed (duplicate)

This is a dupe of #482162: Link paths run through check_plain() break argument handling (thanks merlin for pointing this out).

damienmckenna’s picture

damienmckenna’s picture

Status: Closed (duplicate) » Active

Ok, apologies, #482162: Link paths run through check_plain() break argument handling does not actually fix *this* specific issue. This isssue is more to do with Node:Link than "Display as link".

damienmckenna’s picture

Title: "Output this field as a link" doesn't work with "Node:Link" token, and "Link path:" does too much escaping? » "Output this field as a link" doesn't work with "Node:Link" token

Am removing the second part of this issue as it is handled by #399534: Add fragment and query to render_as_link.

damienmckenna’s picture

StatusFileSize
new1.54 KB

Here's a small patch that adds an option to output the Node:Link field as a raw URL as generated by url('node/$nid'); by default it still generates the full link.

damienmckenna’s picture

Status: Active » Needs review
alienzed’s picture

ever find out why it was doing that? it's doing it for me now too...

damienmckenna’s picture

merlinofchaos said that for this desired result we should do the following:
* Add a Node ID field. Set it to be hidden and move it above the field we want to make a link.
* In the field we're turning into a link add the following as the link URL: node/[nid]
* When it is going to be displayed it will then be converted into the friendly URL.

Not completely intuitive, but it works.

alienzed’s picture

Maybe unrelated, maybe not. I JUST noticed after weeks of randomly having this problem that turning THEME DEVELOPER, part of the devel package, on and off, also makes a similar problem with the basepath being appended appear and disappear.

So if you are experiencing this problem, make sure you don't have theme developper enabled.

damienmckenna’s picture

alienzed: that's not directly related to this, but thanks.

damienmckenna’s picture

(edit)
Nevermind, that was an invalid use case that used Content:Link not Node:Link.

dagmar’s picture

Status: Needs review » Needs work

I think this patch needs a better explanation of what it does in the #description field.

Maybe if you create an small html text for advanced help users can know how works this feature.

jimboh’s picture

Sorry if this is unrelated but I am a noob when it comes to views etc.
I have a view with a field set as 'output as link' with the following in link path: node/1/[field_bname_value]
The problem I am getting is the handling of '& ' in the field.
With field_bname_value =' Schooner landing B&B and Cottage' the link is being supplied as ' /node/1/Schooner%20Landing%20B%2526amp%3BB%20and%20Cottage%20'

which doesent work.
If I remove the 'amp%3b' it works fine

Hope this info is of use

merlinofchaos’s picture

#15: Your problem sounds like http://drupal.org/node/482162 and should be fixed in the -dev version.

dagmar’s picture

Status: Needs work » Closed (duplicate)