Hi,

Please can you help me understand how to use this? What I'm trying to do is display a different view mode for content type based on what theme is being used.

I have a module that automatically switches to another theme if used on a mobile device which is fine but the contents default view is too big for mobile screens, so I have created a new view (I use display suite btw) and I want it to automatically use this view when on the mobile theme. I have followed the instructions on the Contextual View Modes module page but I'm a bit lost. Step 3 says 'Use context module to create a context or two. You do not have to assign a reaction, just the condition.' but I don't know what I should be selecting. Please can you help with this?

Thanks

Comments

sherakama’s picture

Great Question Aaron,

I am guessing you are doing things correctly. There have been some issues around some of the mobile context modules. See: https://drupal.org/node/1859790. Try updating to the latest development version.

The process behind this module is to create a context with the conditions you want met. For your example you will want to create a context where the condition is set to theme = my theme. Then in either the global content type settings or in the individual nodes you will want to select that context and the view mode.

If you are not getting the results you are expecting you may be changing the theme too late. This module executes the view mode change on hook_node_view_alter(). If the custom theme change has not been set by then it may be missed and the context will not assert.

I hope this helps.

-Shea

sherakama’s picture

sherakama’s picture

Assigned: Unassigned » sherakama
aaronmarsh632’s picture

Hi,

Thanks for the reply, I'm using '51Degrees.mobi Mobile Theme Switcher' BTW if this makes a difference. It was the only 1 I could ever get working.

I have created a context with the following conditions...

name = mobile
tag = mobiletheme
description = 'theme = skeletontheme'

Then I added a condition 'Context (any)' and added the line - theme = skeletontheme

Is this correct so far?

I'm not sure exactly what u mean by 'Then in either the global content type settings or in the individual nodes you will want to select that context and the view mode.' I looked in my content types edit pages for something that looks like this but I couldn't see anything unless i'm missing it.

I set the default view mode for my content types in the Contextual View Modes section under the structure menu for the context 'mobile' that I created. (I set it to the view mode I created)

But I don't seem to be getting the result I want. I noticed in the content type manage display section there is a new field called 'Contextual View Mode' - Do I need to do anything with this? I did try adding it to the display as hidden to see what happens but didn't seem to make a difference.

Thanks for the help, I appreciate it.

aaronmarsh632’s picture

Hi, sorry to double post but I really cant figure this out, does anyone have any idea how to do this please?

Thanks

sherakama’s picture

Version: 7.x-1.2 » 7.x-3.x-dev
Status: Active » Fixed

Thanks for posting this issue.

The latest in both the 2.x and 3.x branches should give you theme based switching abilities.

Thanks,

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.