I can't get contextual view modes to display any view mode other than the "default" view mode.
Clean 7.51 install -> Display Suite -> Context -> Contextual View Modes
Create DS view mode: Desktop
Create Context: desktop
- Condition -> Node type: basic page
- Reaction -> View Mode: basic page -> Desktop
I've spent several hours trying to figure this out and stepped backwards trying to see if anything else points out to being the cause, however with only using DS, Context and Contextual View Modes, I can't get any of the other view modes to work. I couldn't get it to work on stable, so I moved to latest dev with no results.
I must note, this is happening with "Contextual View Modes Nodes" disabled. If I enable that sub module and point both the context and view mode to Desktop within the respective node, it uses the view mode properly. Granular only isn't exactly ideal though.
Any ideas? Maybe I'm missing something? As far as I can tell, it should be extremely straight forward to override all of the view modes globally.
Comments
Comment #2
philsward CreditAttribution: philsward commentedFixed title after digging into the problem and narrowing the issue. I originally thought it was related to panelizer but realized the problem happens before panelizer enters the equation.
Comment #3
philsward CreditAttribution: philsward commentedPossibly related to: https://www.drupal.org/node/2827003 ?
Comment #4
philsward CreditAttribution: philsward commentedComment #5
philsward CreditAttribution: philsward commentedFrom what I can tell, CVM is not firing properly on Node Type. All other reactions work as expected from what I can tell. I added some block reactions, menu reactions etc and they all work as expected when using the node type condition. View modes reaction is the only one that is wonky. I also found that if I add an additional condition along with node type, I can get the view mode to work. However, it only works if "require all conditions" is unchecked.
As a control, I tried using path as the only condition and view modes worked properly. As soon as you add Node Type as a second condition and require that all conditions must pass, the view mode will always go back to using the "default" view mode.
Comment #6
philsward CreditAttribution: philsward commentedUpdated title to better reflect the nature of the issue.
Comment #7
philsward CreditAttribution: philsward commentedI had my programmer look at this issue and he came up with a solution. Here's his comments:
This is found in the file: contextual_view_modes.module for the function starting at line 31.
Specifically, change:
to
Adding context_node_condition($context['entity'], 'view'); to line 39
Comment #8
amaisano CreditAttribution: amaisano commentedNoticed the same thing - very frustrating. This was a problem on 2.x as well. Your tweaks make it work.
Comment #9
amaisano CreditAttribution: amaisano commentedComment #11
sherakama CreditAttribution: sherakama commentedThanks for the bump.
I have added the node_context call if there is an entity condition available. It should be on the 3.x dev branch for you shortly.
Comment #12
sherakama CreditAttribution: sherakama commentedComment #13
amaisano CreditAttribution: amaisano commentedGreat stuff @sherakama, thanks.