I have rolled a patch with code updates to the file domain_views/includes/domain_views_handler_field_domain_id.inc.
The patch allows the Domain Source to be rendered as an ID, a site name or a subdomain. Previously subdomain wasn't an option.
Attached is the path, and also some screenshots of the *new* way. The project I rolled this patch for is the home page of http://www.sacramentoinsights.com. We use it to render a list of subdomains on the site.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | better-domain-source-id-rendering-1078056-7x.patch | 4.65 KB | noahlively |
| patch-3.PNG | 22.53 KB | noahlively | |
| patch-2.PNG | 23.95 KB | noahlively | |
| patch-1.PNG | 78.44 KB | noahlively | |
| better-domain-source-id-rendering.patch | 4.03 KB | noahlively |
Comments
Comment #1
agentrickardThis looks pretty handy.
New features go in 7.x.
The plain $text return needs to be sanitized. How does it affect existing uses?
Comment #2
noahlively commentedOK here is a patch for 7.x-1.x-dev.
I sanitized $text through a call to check_plain().
This patch has built in backward compatibility with previous versions. The keys/values of the $options array are slightly different, but logic in the options_form() function will check for legacy values and re-save them in the new format.
Comment #3
agentrickardSuper-awesome.
Any independent reviewers out there?
Comment #4
agentrickardWorks very nicely in D7.
Comment #5
agentrickardI took another look at this. We already have domain fields that cover these options. What does this patch offer that isn't already covered?
Is there a benefit to this extra render element? Better queries?
Comment #6
noahlively commentedWithout the patch I created, if a node is mapped to more than one affiliate domains I get duplicate records showing up in my views output.
Example:
mysite.com
a.mysite.com
b.mysite.com
Node 321 is mapped to mysite.com and a.mysite.com, with a.mysite.com as the source domain. Using technique #3 above, I get duplicate records.
Does what I am saying make sense?
You can view the output (after patch was applied) at http://www.sacramentoinsights.com. The home page renders a list of subdomains with links to the subdomains.
Without the patch, there was no way I found to work around the duplicate record issue after spending hours looking.
Comment #7
agentrickardI think I get it. Domain Source (the module) uses the same domain_id handler as {domain}.domain_id.
I was testing {domain}.domain_id, not {domain_source}.domain_id.
Comment #8
mariusz.slonina commented+1, that patch saved my day today
Comment #9
agentrickardMarking for commit review.
Comment #10
agentrickardCommitted. Also fixed a bunch of minor code style issues in the module.