3

I use display suite module to manage the display of node types. So far so good.

I know that there is a way to have different display for the same node type. Let's say I have 2 nodes of the basic page node type. Then I'd like to set 2 column stacked for the first one and single column for the second node.

But I don't know hot to do it.

0

If the nodes are the same content type, I don't think Display Suite will be enough by itself. You'll have to use another module such as Views or Panels and configure that to specify which display for which node should be shown when.

FYI, there was a pretty good session introducing the many uses of Display Suite at Drupalcon London 2011, which you can watch online.

  • 3
    I just found a workaround, maybe no the best though. 1) Create a new view mode and then 2) set the node to use this new view mode. To be able to do this you need to enable: View mode per node in the display suite extras settings. – chefnelone May 1 '12 at 9:45
3

You can easily do this with display suite but you need to enable the DS extras module.

First create 2 different view modes using different layouts to cover your specific use case.

Next go to admin/structure/ds/list/extras and enable 'View mode per node'.

Now when you create content you can choose which view mode you would like the content to use.

This is a great way to give your content editors control over layout choice.

  • If these instructions don't work for you, you also need to configure the Display Suite Extras' permissions at admin/people/permissions#module-ds. There are "Switch view modes on …" permissions for each content type. – tanius Sep 9 '14 at 0:06
2

A module that extends Display Suite is being written (by clint.beacock) to achieve this (i.e. different displays on a per node basis), although at the time of writing it is not ready for production use:

http://drupal.org/node/1632730

1

If your choice of the view mode for a node depends on some external condition and / or you have a lot of nodes to switch view modes for and / or the choice of view mode has to change over time, you can use the module Contextual View Modes.

It adds to the "View mode per node" feature of the Display Suite Extras module by allowing you to switch view modes for all nodes of a content type based on Context conditions. It also includes options to override these global settings with other conditions for an individual node.

0

The answer is definitely to use multiple view modes. View modes are different configurations of field displays per bundle. D7 comes with "default" and "teaser" but you can add more via hook_entity_info_alter() or by using Display Suite to do this through an easy interface.

The next question is how to actually show the user the 2nd view mode – on node/123/view it's going to use 'default'. You can use a different view mode by using Views and selecting the alternative view mode on the node display settings, or you could load the node programmatically and set the view mode there:

$node = node_load(123);
$node_view = node_view($node, 'my_custom_view_mode');
return $node_view;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.