Reading the code for render_as_field there is a sentence "// These can only be set internally at this time." I'm not sure why this is so maybe this quick patch is too quick?

Anyway I use parse_url to get/set the options fragment and/or query while removing them from the $path

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

clemens.tolboom’s picture

This patch makes it possible to jump strait to node/12#comments, node/12#video which is our dire need :)

deshilachado’s picture

I was looking at the same comment and was wondering whether it is a security issue, but I know to little PHP & Drupal for deciding that.
There are several issues in Views issue queue about the ? or # being encoded, so this seems to be of interest to some more persons. Maybe the patch is only that straight forward for the # and not for the ? ??
Link to another issue realted to fragment being encoded: #371496: Output this field as a link not working?

clemens.tolboom’s picture

Title: Add fragment and query to render_as_link to render_as_link » Add fragment and query to render_as_link
clemens.tolboom’s picture

Status: Active » Needs review
deshilachado’s picture

Applied the patch and it worked for me: As a field I chose Node:Nid, output as a link, rewrite the link as comment/reply/[nid]#comment-form and the link that is being displayed works. Great!

I also tried Node:Link + rewrite output but then the there was some escpaed HTML (<a href...>) in the link.

dagomar’s picture

I also was in need of this. For me the patch works. Hopefully this can be committed!

clemens.tolboom’s picture

@ #5 I not quite follow your escaped HTML ... it that a bug?

deshilachado’s picture

I'm not sure, but I think this is not a bug and doesn't result from your patch, but is a small weirdness in Views as described in comments #9 and #10 in issue #378710: "Output this field as a link" is unnecessarily escaped

clemens.tolboom’s picture

Status: Needs review » Reviewed & tested by the community

Based on #5 and after feedback #8 about #6 I guess this patch is reviewed and tested :)

drewish’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
5.79 KB

talked with merlin a bit on irc about this patch and he felt it needed a little more work. i'm adding a class and doing some coding standards clean up on it.

deshilachado’s picture

drewish, thanks for the work. I fail to apply the patch though, a simple patch -p0 < views_399534.patch doesn't do it for me but instead gives back

can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/drupal-6/modules/cck/CVS/Entries b/drupal-6/modules/cck/CVS/Entries
|index 812f9d5..2d87b41 100644
|--- a/drupal-6/modules/cck/CVS/Entries
|+++ b/drupal-6/modules/cck/CVS/Entries
--------------------------

I put the patch in all folders that make sense to me and tried patching from each location respectively.

merlinofchaos’s picture

Status: Needs review » Needs work

Yup, I'm having trouble with that patch myself.

drewish’s picture

Status: Needs work » Needs review
FileSize
3.42 KB

okay how about this?

drewish’s picture

Version: 6.x-2.3 » 6.x-2.x-dev
Category: bug » feature

fixing the status, i think this is less a bug fix than a feature.

deshilachado’s picture

Status: Needs review » Reviewed & tested by the community

Works for me:
Applied the patch and tried the following (as above): Create e new View, as field choose Node:Nid, output as a link, rewrite the link as comment/reply/[nid]#comment-form and the link that is being displayed works.
Thanks!
I did not test queries

dawehner’s picture

i looked at the patch and saw this:

+        'link_class' => array('default' => '', 'translatable' => TRUE),

Why is link_class translatable?

drewish’s picture

FileSize
3.42 KB

dereine, all the other text was translateable, and i could imagine a case where you'd want to change the class based on the language... i'm not too concerned either way, if earl wants it out i'll re-roll with out it.

the last patch had gone stale so here's a re-roll.

deshilachado’s picture

Again, I applied the fresh patch and did the same simple test as above (which is a scenario I might use indeed).
Worked as expected

stevekerouac’s picture

Applied the patch from #17 in a similar fashion to that described in #5. Confirm it is working as expected.

pescetti’s picture

From discussions in #470904: Ampersand [&] gets replaced by [&amp;] in the created URLs, this seems to be the same root cause for "&" being rendered as "&amp;"; subscribing.

robertdjung’s picture

@pescetti -- I thought so too, but I've patched and still have the issue. Guidance?

Heilong’s picture

Just applied the patch and working...

pescetti’s picture

@robertdjung: the patch in comment #17 does not work for me either (meaning: it does not solve the problem with ampersands in link URIs).
If the problem in #470904: Ampersand [&] gets replaced by [&amp;] in the created URLs is really a duplicate of this one, then the patch should be reworked in order to fix the ampersand problem too.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Looks like we're in good shape on this one now. Committed!

robertdjung’s picture

@pescetti, it's not a duplicate, it's related to feedapi instead.
For now, I've hacked the views module (SHAME!) in this manner: http://drupal.org/node/393470
See also: http://drupal.org/node/352004

pescetti’s picture

@robertdjung: Thanks, but then my problem is different, since I'm not using feedapi. I'll investigate again and reopen #470904: Ampersand [&] gets replaced by [&amp;] in the created URLs if needed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.