Closed (fixed)
Project:
Domain
Version:
6.x-2.0-rc6
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 May 2009 at 04:56 UTC
Updated:
31 May 2009 at 18:35 UTC
custom_url_rewrite is not a hook. By defining it, you prevent sites from defining their own behavior for this function.
Attached patch will not break existing sites, but will make it possible to override domain's url rewrites as needed.
| Comment | File | Size | Author |
|---|---|---|---|
| domain_custom_rewrite.diff | 812 bytes | Dave Cohen |
Comments
Comment #1
agentrickardI don't think 'steals' is correct. It implements the function, which 99% of site do not use.
This is a well-documented issue. Most sites do not use custom_url_rewrite_outbound(). Using that function requires that you add custom code to your site, so we can safely assume that people using the function will understand the error.
Section 3 of INSTALL_QUICKSTART.txt: (there is also a note in 4.5 of INSTALL.txt)
The patch may prevent an unexpected error, but it doesn't work, because what we need to do in those cases is merge the two functions.
Is there a way to make domain_url_rewrite_outbound() run and then call the other function? (Or vice versa?) Even so, I don't think that will work, since the business logic of the function probably needs examining in all cases.
Comment #2
Dave Cohen commentedi18n and Drupal for Facebook also implement these functions. In both, there is logic similar to whats in the patch.
Here's an example of custom url rewrites which is possible with the patch I supplied, but not possible without it. This would be in someone's settings.php, for example...
Sure, the custom url rewrite function leave something to be desired. And there are patches to make them hooks instead of single functions. But in my opinion a module should be written in a way that makes it easy for people to build their sites. Is your idea is that if someone needs a customized url rewrite, they should change the logic in sites/all/modules/domain/settings_custom_url.inc? Sounds like a big headache if you ever make a change to that same file.
Comment #3
agentrickardYeah, that explanation makes sense. This really isn't something we've had to deal with.
Can you write that into the patch as some documentation?
Comment #4
agentrickardCommitted to HEAD. Needs documentation.
Opening new issue. #450998: Document use of domain_url_rewrite_outbound()
Comment #6
agentrickardThis has been fixed in 5.x as well, though it is of less concern there.