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.

Comments

agentrickard’s picture

Project: Domain » Domain Views
Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Needs work

This looks pretty handy.

New features go in 7.x.

The plain $text return needs to be sanitized. How does it affect existing uses?

noahlively’s picture

OK 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.

agentrickard’s picture

Status: Needs work » Needs review

Super-awesome.

Any independent reviewers out there?

agentrickard’s picture

Title: domain_views: Patch to allow more flexibility in rendering Domain Source ID field » domain_views: Patch to allow more flexibility in rendering Domain ID field

Works very nicely in D7.

agentrickard’s picture

I 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?

noahlively’s picture

Without 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.

  1. I tried using the Domains: Subdomain field.... but that outputs the active subdomain, not necessarily the source domain of the node.
  2. Domain Source doesn't provide a subdomain option (until this patch)
  3. If I add a relationship to the source domain, then add the field "Domains: Subdomain" using the newly added relationship, I one row per affiliate domain mapped to the node.
  4. 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.

agentrickard’s picture

I 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.

mariusz.slonina’s picture

+1, that patch saved my day today

agentrickard’s picture

Status: Needs review » Reviewed & tested by the community

Marking for commit review.

agentrickard’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Also fixed a bunch of minor code style issues in the module.

Status: Fixed » Closed (fixed)
Issue tags: -domain_views

Automatically closed -- issue fixed for 2 weeks with no activity.