You are here

function hook_query_file_entity_access_alter in File Entity (fieldable files) 8.2

Same name and namespace in other branches
  1. 7.3 file_entity.api.php \hook_query_file_entity_access_alter()
  2. 7.2 file_entity.api.php \hook_query_file_entity_access_alter()

Control access to listings of files.

Parameters

object $query: A query object describing the composite parts of a SQL query related to listing files.

See also

hook_query_TAG_alter()

File

./file_entity.api.php, line 21
Hooks provided by the File Entity module.

Code

function hook_query_file_entity_access_alter(AlterableInterface $query) {

  // Only show files that have been uploaded more than an hour ago.
  $query
    ->condition('timestamp', \Drupal::time()
    ->getRequestTime() - 3600, '<=');
}