You are here

function _node_gallery_gallery_view in Node Gallery 6.3

Same name and namespace in other branches
  1. 6.2 node_gallery.module \_node_gallery_gallery_view()

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

Parameters

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

$teaser: A parameter corresponding to the $a3 parameter in hook_nodeapi().

$page: A parameter corresponding to the $a4 parameter in hook_nodeapi().

1 call to _node_gallery_gallery_view()
node_gallery_nodeapi in ./node_gallery.module
Implements hook_nodeapi().

File

./node_gallery.module, line 724
Node gallery module file.

Code

function _node_gallery_gallery_view(&$node, $teaser = NULL, $page = NULL) {
  $relationship = node_gallery_get_relationship($node->type);
  $config = $relationship['settings'];
  $cck_weight = content_extra_field_weight($node->type, 'gallery');
  $weight = is_numeric($cck_weight) ? $cck_weight : -3;
  if (!$teaser) {
    node_gallery_set_user_breadcrumb($node->uid, $node);
    $viewkey = unserialize($config['view_gallery_full_image_display']);

    // @todo: we should be able to programmatically set some options on the view, such as number of images, imagefield_name, etc.
    $output = _node_gallery_views_embed_view($viewkey['name'], $viewkey['display_id'], $node->nid);
    $node->content['gallery'] = array(
      '#value' => $output,
      '#weight' => $weight,
    );
  }
  else {
    $viewkey = unserialize($config['view_gallery_teaser_view_image_display']);

    // @todo: we should be able to programmatically set some options on the view, such as number of images, imagefield_name, etc.
    $output = _node_gallery_views_embed_view($viewkey['name'], $viewkey['display_id'], $node->nid);
    $node->content['gallery'] = array(
      '#value' => $output,
      '#weight' => $weight,
    );
  }
}