Download & Extend

How to find a node based on the domain?

Project:Domain Access
Version:6.x-2.0-rc9
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I'd like to be able to load a node based on its' type and the domain to which it belongs.

Now, finding a node based on type is pretty straight forward; I just do a :


$node = node_load(array('type' => 'story'));

This doesn't work:

$node = node_load(array('type' => 'story', 'domains' => array('2' => '2'));

I couldn't figure out a programatic way to find a node that is a particular type and that belongs to a particular domain. Instead, I'm just doing it manually thru SQL, joining the node and domain_access table.

Is there a 'recommended' way to programatically get a node that belongs to a particular domain?

TIA

Comments

#1

Other than using Views, no. Core node_load() does not allow JOINs to other tables.

Doing a join to {domain_access} should be fine (and properly indexed).

#2

Status:active» closed (fixed)