function photos_node_view in Album Photos 7.3
Same name and namespace in other branches
- 8.5 photos.module \photos_node_view()
- 8.4 photos.module \photos_node_view()
- 6.0.x photos.module \photos_node_view()
Implements hook_node_view().
File
- ./
photos.module, line 628 - Implementation of photos.module.
Code
function photos_node_view($node, $view_mode, $langcode) {
if ($node->type == 'photos') {
global $user;
$display_types = array(
'none',
'cover',
'thumbnails',
'coverthumbs',
);
switch ($view_mode) {
case 'full':
$default_display = variable_get('photos_display_page_display', 1);
$display = isset($node->album['page_display']) ? $node->album['page_display'] : $default_display;
$album = _photos_node_view($node, $display, $view_mode);
$node->content['album-' . $display_types[$display]] = array(
'#markup' => $album,
);
break;
case 'teaser':
$default_display = variable_get('photos_display_teaser_display', 1);
$display = isset($node->album['teaser_display']) ? $node->album['teaser_display'] : $default_display;
$album = _photos_node_view($node, $display, $view_mode);
$node->content['album-' . $display_types[$display]] = array(
'#markup' => $album,
);
break;
}
}
if ($node->type == 'photos' || variable_get('photos_node_' . $node->type, 0)) {
// Links.
$links = array();
if (user_access('view photo') && (isset($node->subalbum['count']) || isset($node->album['count']))) {
if ($node->type == 'photos') {
$title = t('Album view');
$type = 'album';
}
else {
$title = t('Sub-Album view');
$type = 'sub_album';
}
$count = 0;
if (!empty($node->subalbum['count'])) {
$count = $node->subalbum['count'];
}
elseif (!empty($node->album['count'])) {
$count = $node->album['count'];
}
if ($count != 0) {
$links['photos_album'] = array(
'title' => $title,
'href' => 'photos/' . $type . '/' . $node->nid,
'attributes' => array(
'title' => t('A total of !count images', array(
'!count' => $count,
)),
),
);
if (variable_get('photos_slide', 0) && module_exists('dfgallery')) {
$links['photos_slide'] = array(
'title' => t('Slideshow'),
'href' => 'photos/' . $type . '/' . $node->nid . '/slide',
);
}
}
}
$node->content['links']['photos'] = array(
'#theme' => 'links__node__photos',
'#links' => $links,
'#attributes' => array(
'class' => array(
'links',
'inline',
),
),
);
}
}