The Node View Mode module enables content editors to choose how a field collection field is displayed on a node, by selecting which view mode should be used.

Field Collections

A field collection is a type of field that contains a mix of other fields, for instance on the content type Organisation a Staff field collection can be added, which contains a Photo image field, and text fields for Name and Description.



View Modes

A view mode specifies if and how each field of a content type should be displayed. Out of the box Drupal provides five view modes, and more can be added in various ways, most easily with the Display Suite or Entity View Modes modules.



The Full content view mode is normally used to display nodes when accessed on their path, i.e. node/6 or it's alias staff/example, and any field collections on a node are also displayed with the Full content view mode. Display Suite enables content creators to choose which view mode is used for displaying a node, but there hasn't been a way to do the same for field collections until now, Node View Mode module provides this feature.

Drupal Node View Mode Module

A typical use for Node View Mode would be on a node where a field collection only has one item, in the example above one Staff member, Full Content view mode can be selected to shows a large Photo image, Name, and the Description field in full, while on a node where the field has several items, Teaser view mode can be selected to show only a small Photo image and Name field for each Staff.

Configuration

Once you've added a field collection to a content type, add a Field Collection View Mode field to the same content type. This will be the field where content editors can choose which view mode to use to display the field collection on the node they are creating or editing.



The settings for the Field Collection View Mode field enable you to select which field collection it's associated with, and which view modes will be available for users to choose from.



Lastly, go to the Manage Display tab of the content type, and set the field collection field's format to Selectable view modes, then move the Field Collection View Mode field to Hidden.


Usage

The view mode selector is now available for content creators to choose how a node will display the associated field collection.



 

Module Info