The internal entity cache is interfering with display modes on my site. I have a view that is displaying a node with a custom display mode, 'slideshow'. When I look at the view from a page that displays the entity in a different display mode along side the slideshow block, the node is rendered as that mode and not slideshow, but the other nodes in the block display using 'slideshow'.
hacking core, and rewriting node.module:
node_load_multiple($nids = array(), $conditions = array(), $reset = FALSE)
to
node_load_multiple($nids = array(), $conditions = array(), $reset = TRUE)
resolves the issue. Under performance, caching is on for anonymous users. This is occurring while logged in. I've tried entitycache in the past, but it is not installed. Drush cc all does nothing. I'm open to any ideas that may help.
Here is the offending part of a backtrace that I managed to pull up:
It looks like somewhere in theme.inc the wrong template is being chosen:
10 (Array, 4 elements) file (String, 52 characters )
/home/mysite/git/mysite/includes/them...
/home/mysite/git/mysite/includes/theme.inc line (Integer) 1185
function (String, 21 characters ) theme_render_template | (Callback)
theme_render_template();
args (Array, 2 elements)
0 (String, 70 characters ) sites/all/themes/mysite/templates/ds/ds-...
sites/all/themes/mysite/templates/ds/ds-1col--node-post.tpl.php
1 (Array, 86 elements)
It only affects the node being rendered currently, which isn't a post and shouldn't be using that template when it shows up in the slideshow block. I've grepped around for theme_hook_suggestions but haven't found any.
---EDIT--- I've tracked it down to this code in views:
function pre_render($values) {
$nids = array();
foreach ($values as $row) {
$nids[] = $row->{$this->field_alias};
}
$this->nodes = node_load_multiple($nids);
}
function render($row) {
if (isset($this->nodes[$row->{$this->field_alias}])) {
$node = $this->nodes[$row->{$this->field_alias}];
$node->view = $this->view;
$build = node_view($node, $this->options['view_mode']);
return drupal_render($build);
}
For what ever reason, node_load_multiple is returning the current node being viewed with the type set to 'post', instead of the correct content type. Why would there be malformed nodes in the site's internal cache?