You are here

function node_gallery_create_thumbnail_node_view_mode in Node Gallery 7

Sets up Node Gallery Thumbnail view mode for nodes.

Parameters

string $item_type:

string $field_name:

2 calls to node_gallery_create_thumbnail_node_view_mode()
node_gallery_setup_content_types in ./node_gallery.install
Set up default content types.
node_gallery_update_7002 in ./node_gallery.install
Migrate Node Gallery relationships to Drupal 7 relationship entities.

File

./node_gallery.install, line 125
Install, update and uninstall functions for the node_gallery module.

Code

function node_gallery_create_thumbnail_node_view_mode($item_type = NODE_GALLERY_DEFAULT_ITEM_TYPE, $field_name = NODE_GALLERY_DEFAULT_MEDIA_FIELD) {
  $instance = field_info_instance('node', $field_name, $item_type);

  // Default View mode.
  $instance['display']['default']['label'] = 'hidden';
  $instance['display']['default']['type'] = 'file_rendered';
  $instance['display']['default']['settings']['file_view_mode'] = 'node_gallery_file_display';

  // Teaser.
  $instance['display']['teaser']['label'] = 'hidden';
  $instance['display']['teaser']['weight'] = 1;
  $instance['display']['teaser']['type'] = 'file_rendered';
  $instance['display']['teaser']['settings']['file_view_mode'] = 'node_gallery_file_display';

  // Node gallery thumbnail.
  $instance['display']['node_gallery_node_thumbnail']['label'] = 'hidden';
  $instance['display']['node_gallery_node_thumbnail']['type'] = 'file_rendered';
  $instance['display']['node_gallery_node_thumbnail']['settings']['file_view_mode'] = 'node_gallery_file_thumbnail';
  field_update_instance($instance);
}