You are here

function _node_gallery_api_gallery_view in Node Gallery 7

Attaches the gallery node's image view to the node's content.

Parameters

object $node: A reference to the gallery node object.

string $view_mode: View mode.

1 call to _node_gallery_api_gallery_view()
node_gallery_api_node_view in ./node_gallery_api.module
Implements hook_node_view().

File

./node_gallery_api.module, line 1152
Node Gallery module.

Code

function _node_gallery_api_gallery_view(&$node, $view_mode) {
  $relationship_type = node_gallery_api_get_relationship_type($node->type);
  $config = $relationship_type->settings;
  $extra_field_settings = field_extra_fields_get_display('node', $node->type, $view_mode);
  if ($view_mode == 'full') {

    // node_gallery_set_user_breadcrumb($node->uid, $node);
  }
  if (isset($config['view_modes'][$view_mode])) {
    list($view_name, $view_display) = explode(':', $config['view_modes'][$view_mode]['view']);

    // @todo: we should be able to programmatically set some options on the view, such as number of images, filefield_name, etc.
    $output = _node_gallery_api_views_embed_view($view_name, $view_display, $node->nid);
    $node->content['node_gallery_view'] = array(
      '#markup' => $output,
      // '#label_display' => 'hidden',
      '#access' => TRUE,
      '#weight' => isset($extra_field_settings['node_gallery_view']['weight']) ? $extra_field_settings['node_gallery_view']['weight'] : 0,
    );
  }
}