function media_gallery_node_view_alter in Media Gallery 7.2
Same name and namespace in other branches
- 7 media_gallery.module \media_gallery_node_view_alter()
Implements hook_node_view_alter().
File
- ./
media_gallery.module, line 1189
Code
function media_gallery_node_view_alter(&$build) {
// This is for the Galleries plural page
if ($build['#bundle'] == 'media_gallery' && $build['#view_mode'] == 'teaser') {
// Hide node links.
$build['links']['#access'] = FALSE;
unset($build['#contextual_links']);
_media_gallery_attach_css_resources($build);
}
elseif ($build['#view_mode'] == 'media_gallery_block') {
// Hide node links.
$build['links']['#access'] = FALSE;
_media_gallery_attach_css_resources($build);
}
elseif ($build['#bundle'] == 'media_gallery' && $build['#view_mode'] == 'full') {
if (!empty($build['media_gallery_file'])) {
foreach (element_children($build['media_gallery_file']) as $delta) {
// For each media item, add contextual links to the in-gallery-context
// tasks that can be performed on a media item.
$fid = $build['media_gallery_file'][$delta]['#file']->fid;
$build['media_gallery_file'][$delta]['#contextual_links']['media_gallery'] = array(
'media-gallery/detail',
array(
$build['#node']->nid,
$fid,
),
);
}
}
_media_gallery_attach_css_resources($build);
}
}