You are here

function node_gallery_preprocess_node in Node Gallery 6.2

Same name and namespace in other branches
  1. 6.3 node_gallery.module \node_gallery_preprocess_node()
  2. 6 node_gallery.module \node_gallery_preprocess_node()

File

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

Code

function node_gallery_preprocess_node(&$vars) {
  $node = $vars['node'];
  $page = $vars['page'];
  if (in_array($node->type, (array) node_gallery_get_types('image'))) {
    if ($page) {
      $config = node_gallery_get_image_parent_gallery_config($node);
      if (function_exists('comment_render')) {
        if ($config['image_comment'] == 'image' && $node->image_comment) {
          $vars['comments'] = comment_render($node);
        }
        elseif ($config['image_comment'] == 'gallery') {
          $gallery_node = node_load($node->gid);
          if ($gallery_node->comment) {
            $vars['comments'] = comment_render($gallery_node);
          }
        }
      }
    }
    array_pop($vars['template_files']);
    $vars['template_files'][] = "node-image-default";
    $vars['template_files'][] = "node-" . $node->type;
    $node_classes[] = 'node-node_gallery-image';
  }
  $node_classes[] = 'node-' . $node->type;
  $vars['node_classes'] = implode(' ', $node_classes);
}