I am trying to add prepopulate query strings to the link in my footer of the view.

I try to add link path like thus:

node/add/image?edit[field_gallery][0][nid][nid]=%1

and the resulting link on the page becomes this:

node/add/image%3Fedit%5Bfield_gallery%5D%5B0%5D%5Bnid%5D%5Bnid%5D%3DGallery

Which I don't know how to work around. There is probably an urlencode or something going on. Is it neccessary?

I also tried to add stuff into the Link querystring, like this:

edit[field_gallery][0][nid][nid]=%1

But it doesn't work, it just disappears upon updating the "Link querystring" form field. I also tried with "?" in front of the query string.

Any help would be apprecieated; for the moment I will just remove locally any urlencoding I can find in the module.

CommentFileSizeAuthor
#2 urldecode-link-render-1104794-4257962.patch617 bytespkej

Comments

pkej’s picture

I changed line 99 in the file views_handler_area_link.inc from:

return l(strtr($this->options['text'], $tokens), strtr($this->options['path'], $tokens), $link_options);

to:

return urldecode(l(strtr($this->options['text'], $tokens), strtr($this->options['path'], $tokens), $link_options));

And now the links work as they should.

pkej’s picture

Status: Active » Needs review
StatusFileSize
new617 bytes

A patch, I hope.

pkej’s picture

Component: Miscellaneous » Code
Category: bug » feature

I guess it isn't a bug, but a natural side effect of using l(). Therefore this is probably å feature request.

geek-merlin’s picture

i had a similar thing with views filters and the encoded string DID work there.
did you test that it does NOT work with prepopulate?
in that case i think it might be a prepopulate issue: the module should use urldecode there.

anybody’s picture

Status: Needs review » Active

Anything new here?

I think we should discuss this and review the results to bring this issue to an end?

kristofferwiklund’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

I have done some testing with latest version of this module (7.x-1.1) and prepopulate (7.x-2.1) and it works.

Given link path: node/add/news
Given link querystring: edit[title]=test

It produces this link: node/add/news?edit%5Btitle%5D=test

But clicking on the link the Title field is populated with test for a new News node.

And if this problem is for Drupal 6 and I am sorry to inform that it is deprecated.