You are here

function media_acquiadam_dam_refresh_page in Media: Acquia DAM 7

Refresh the Acquia DAM asset from 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_refresh_page'
media_acquiadam_menu in ./media_acquiadam.module
Implements hook_menu().

File

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

Code

function media_acquiadam_dam_refresh_page($file) {
  $asset = media_acquiadam_file_to_asset($file);
  if (empty($asset)) {
    return MENU_NOT_FOUND;
  }
  media_acquiadam_flush_cache([
    $asset['id'],
  ]);
  drupal_set_message(t('Local cache was cleared for @name (@id).', [
    '@name' => $asset['name'],
    '@id' => $asset['id'],
  ]), 'status');
  $uri = entity_uri('file', $file);
  drupal_goto($uri['path']);
}