function node_gallery_preprocess_node in Node Gallery 6
Same name and namespace in other branches
- 6.3 node_gallery.module \node_gallery_preprocess_node()
- 6.2 node_gallery.module \node_gallery_preprocess_node()
File
- ./
node_gallery.module, line 492 - Node gallery module file.
Code
function node_gallery_preprocess_node(&$vars) {
$node = $vars['node'];
$page = $vars['page'];
if (gallery_config_gateway::get_types('gallery', $node->type)) {
$config = gallery_config_gateway::get_by($node->type);
if ($page) {
$vars['gallery_operations'] = node_gallery_operations('gallery', $node);
$vars['gallery'] = theme('gallery_images_list', $node, $config);
}
else {
$vars['gallery'] = theme('gallery_teaser', $node, $config);
}
array_pop($vars['template_files']);
$vars['template_files'][] = "node-gallery-default";
$vars['template_files'][] = "node-" . $node->type;
}
elseif (gallery_config_gateway::get_types('image', $node->type)) {
$config = gallery_config_gateway::get_by($node->gid, 'id');
$gallery = new Gallery(array(
'nid' => $node->gid,
));
if ($page) {
$vars['image_navigator'] = theme('gallery_image_navigator', $gallery
->get_image_navigator($node->nid), $node);
$vars['image'] = theme('node_gallery_image', $config, $node);
if ($config->content_display == 'gallery' && function_exists('comment_render')) {
$gallery_node = node_load($node->gid);
if ($gallery_node->comment) {
$vars['comments'] = comment_render($gallery_node);
}
}
elseif ($config->content_display == 'image' && function_exists('comment_render') && $node->old_comment) {
$vars['comments'] = comment_render($node);
}
}
else {
$vars['image'] = theme('node_gallery_image', $config, $node);
}
array_pop($vars['template_files']);
$vars['template_files'][] = "node-image-default";
$vars['template_files'][] = "node-" . $node->type;
}
}