1 file_module_test.module file_module_test_file_download_access($field, $entity_type, $entity)

Implements hook_file_download_access().

File

core/modules/file/tests/file_module_test/file_module_test.module, line 90
Provides File module pages for testing purposes.

Code

function file_module_test_file_download_access($field, $entity_type, $entity) {
  list(, , $bundle) = entity_extract_ids($entity_type, $entity);
  $instance = field_info_instance($entity_type, $field['field_name'], $bundle);
  // Allow the file to be downloaded only if the given arguments are correct.
  // If any are wrong, $instance will be NULL.
  if (empty($instance)) {
    return FALSE;
  }
}