- 🇬🇧United Kingdom superspring
This patch passes $_GET['q'] through url() to give it a nicer URL.
- 🇧🇪Belgium drupalshrek
Shouldn't this rather use the http://api.drupal.org/api/drupal/includes%21common.inc/function/l/7 function?
As the http://api.drupal.org/api/drupal/includes%21common.inc/function/url/7 page says:
When creating links in modules, consider whether l() could be a better alternative than url().
The difference between the two is subtle, and maybe you understand why url() is the better choice here, in which case I'd love to understand the reasoning so I can understand these two better. My understanding currently is to use l() in preference to url() wherever possible.
- 🇬🇧United Kingdom superspring
Hey drupalshrek,
My main thoughts on the difference between url() and l() are that url() returns a nice URL, l() returns an HTML tag which contains a nice URL.
In this example, only the URL itself is needed, not the tag. I expect the code would not work properly if HTML was added where only a URL is expected.
The quote you gave above I suspect is for modules that are creating their own tags and placing nice URLs into them (such as what l() does).
Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version → .