You are here

function media_acquiadam_dam_view_page in Media: Acquia DAM 7

View the Acquia DAM asset on the DAM source.

Parameters

object $file: The file that has an associated asset.

Return value

int A menu response code or a redirect.

1 string reference to 'media_acquiadam_dam_view_page'
media_acquiadam_menu in ./media_acquiadam.module
Implements hook_menu().

File

includes/media_acquiadam.pages.inc, line 68
Page callback implementations.

Code

function media_acquiadam_dam_view_page($file) {
  $asset = media_acquiadam_file_to_asset($file);
  if (empty($asset)) {
    return MENU_NOT_FOUND;
  }
  try {
    drupal_goto($asset
      ->getDAMUrl(), [
      'absolute' => TRUE,
      'external' => TRUE,
    ]);
  } catch (Exception $x) {
    watchdog_exception('media_acquiadam', $x);
  }
  return MENU_ACCESS_DENIED;
}