Posted by nirbhasa on September 16, 2009 at 2:42am
3 followers
| Project: | Domain Access |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I have domains such as uk.example.com and us.example.com. If users on these domains upload an image using Imagefield, I would like the image to be stored in /files/us and files/uk respectively. I have attached a patch providing a token for this.
In my patch, the tokens are called [domain-prefix] and [domain-prefix-raw], which I just realised might cause unnecessary confusion with the Domain Prefix module. However, Im a bit stumped as to what the first bit of the subdomain is called (its also way past my bedtime at the moment). If an alternative name can be suggested, Ill submit another patch.
| Attachment | Size |
|---|---|
| domain_prefix_token.patch | 1.78 KB |
Comments
#1
How about [domain-subdomain], with documentation. It would especially need a note that it really only works with *.example.com formats.
#2
I changed the token names as per your suggestion, and added an extra note to the token description.
#3
Looks good to me.
#4
This makes sense for image and file fields, less useful with PathAuto.
I altered the code to ensure that the domain string is at least three elements. If not, then you are on the primary domain and the prefix 'www' is used by default. If the primary domain is something like uk.example.com, then 'uk' is returned.
Committed to HEAD!
#5
Automatically closed -- issue fixed for 2 weeks with no activity.