1.20.x file.api.php hook_file_view_alter(&$build, $type)

Alter files as they are viewed.

File

modules/file/file.api.php, line 187
Hooks for file module.

Code

function hook_file_view_alter(&$build, $type) {
  // Change the contextual link to edit the file.
  if ($view_mode != 'full' && $view_mode != 'preview') {
    $build['#contextual_links']['file']['#links']['edit'] = l(t('Manage'), 'file/' . $file->fid);
  }
}