I'm using the EntityFieldQuery API to query a series of nodes for a specific domain. I then use node_load_multiple().
When looking at the results I noticed that all the nodes in the resulting array had the domain_source property of the node object set to the same value when in fact the nodes should have different domain_source values.
The problem seems to be something to do node_load_multiple() using the entiry_load() method instead of node_load(). I wrote my own function the iterates over the EntityFieldQuery results and returns the node objects using node_load(). The resulting array this time has the correct domain_source values.
Here is a example of the code using node_load_multiple():
$query = new EntityFieldQuery();
$result = $query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'page')
->propertyCondition('status', 1, '=')
->execute();
$nodes = node_load_multiple(array_keys($result['node']));
kpr($nodes)
exit;
You'll need to install/enable the devel to use the kpr() function.
Here is my workaround that returns the correct domain_source values:
$query = new EntityFieldQuery();
$result = $query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'page')
->propertyCondition('status', 1, '=')
->execute();
$nids = node_load_multiple(array_keys($result['node']));
$nodes = array();
foreach($nids as $nid) {
$nodes[] = node_load($nid);
}
kpr($nodes)
exit;
I'm not sure if the bug is to do with the Domain Access module or a bug in Drupal core.
Closed: outdated
3.0
- Domain Source
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.