Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I'm using CVM with Domain Access and Domain Context to make the site use a different display view mode instead of the 'Full content' one for different domains. I'm currently encountering a bug where if I have a node reference field on a node defined, the node will render with the view mode of the referenced node instead of the parent one.
How to repeat
- Edit a node, add a value for a node reference field (that is configured to display using Rendered Node formatter) that has a different context to the main node
- Save node
What happens
- Node is rendered with wrong view mode (it is rendered with view mode that would have suited for the context of the referenced node specified in the node reference field)
What should happen
- Contextual View Mode should ignore the context of the referenced node, and only work on the main page node instead
I think what happened is that the contextual_view_modes_node_view_alter() function fails to make a distinction between the main page node and any node that is being processed for the page. I'll attach a patch shortly.
Thanks,
Victoria
Comment | File | Size | Author |
---|---|---|---|
#1 | contextual_view_modes-node_reference_wrong_view_mode-2104691-1.patch | 1.06 KB | victoriachan |
Comments
Comment #1
victoriachan CreditAttribution: victoriachan commentedPatch attached
Comment #2
Yazzbe CreditAttribution: Yazzbe commentedDid that work for you? I'm in the exact same situation having domain access and domain context installed.
I've setup the global view modes per domain and content type, defined and tested the context, I'm having reference fields to other conten types & taxonomies ... and the wrong view mode is loaded.
Bb
Comment #3
zerolab CreditAttribution: zerolab commentedRunning this patch on production on a large website without any issues.
Comment #5
sherakama CreditAttribution: sherakama commentedCommitted to dev.
Thank you for this.