1.20.x file.pages.inc file_view_page($file)

Menu callback; view a single file entity.

File

modules/file/file.pages.inc, line 420
Supports file operations including Manage and Delete.

Code

function file_view_page($file) {
  backdrop_set_title($file->filename);

  $uri = entity_uri('file', $file);
  // Set the file path as the canonical URL to prevent duplicate content.
  backdrop_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE);
  // Set the non-aliased path as a default shortlink.
  backdrop_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE);

  return file_view($file, 'full');
}