function rh_file_file_view in Rabbit Hole 7.2
Implements hook_file_view().
File
- modules/
rh_file/ rh_file.module, line 114 - Main module file for Rabbit Hole files module.
Code
function rh_file_file_view($file, $view_mode, $langcode) {
if ($view_mode != 'full') {
// The file isn't viewed using the full view mode, exit early.
return;
}
// Determine whether or not the file is being viewed at it's own page. The
// logics for this has been taken from node_is_page().
$page_file = menu_get_object('file');
$file_is_page = !empty($page_file) ? $page_file->fid == $file->fid : FALSE;
// Execute Rabbit Hole, if the file is being viewed at its own page, and the
// current user isn't able to override Rabbit Hole.
if ($file_is_page && !user_access('bypass rh_file')) {
rabbit_hole_execute('file', $file);
}
}