Closed (fixed)
Project:
Prepopulate
Version:
7.x-2.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2011 at 12:37 UTC
Updated:
3 Jul 2012 at 18:41 UTC
Hi,
I would like to make a link with the l api :
l($text,$path);
But $path is sanitized and the link doesn't works.
Even if it is a l api issue, do you have a idea how I can figure out ?
Thx
Ben
Comments
Comment #1
spouilly commentedI am having a similar issue.
I can use prepopulate with OG to prepopulate the group audience of a post. The url for such effect is:
Where NN is the group ID of the group I am targeting.
I tested manually, and if I enter the URL in the browser ... everything is fine. The issue is that I am generating some links in a module, and following Drupal's best practises, I use the l() function, and the ?part must be in the 'query'.
And this generate something like:
You will immediatly notice that the "[" and "]" have been "sanitized", and I do not see any option allowing to bypass such process (FYI it is happeing in drupal_http_build_query() which is called by url()).
So I have ressorted to write raw url (i.e not to use the l() function for that purpose), but if someone has found a way to use l() properly with prepopulate, I would be more than happy to learn from him/her.
Cheers,
S.
Comment #2
koppie commentedI was also trying to make links to create content inside an OG. I just used html with a token:
<a href="/node/add/event?edit[group_audience][und]=!1">Add a new event</a>That may not be "Drupal best practices," but it works. At least for OG content creation links, it seems like we're in a bit of a Twilight Zone right now - there was a feature for OG 6.x that was lost in the transition to OG 7.1. 7.2 includes this feature (at least as an add-on module) but OG 7.2 isn't production ready yet.
Given that there is no pre-supplied solution, I think "best practices" in this case is whatever actually works. If you can get it to work as a Drupal API query, more power to you.
I'm marking as "fixed" since we seem to have a workable solution; feel free to reopen if you're not satisfied.