function file_module_test_file_download_access

Implements hook_file_download_access().

File

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

Code

function file_module_test_file_download_access($field, EntityInterface $entity, File $file) {
  $instance = field_info_instance($entity
    ->entityType(), $field['field_name'], $entity
    ->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;
  }
}