You are here

public function EntityReference_SelectionHandler_Generic_file::entityFieldQueryAlter in Entity reference 7

Implements EntityReferenceHandler::entityFieldQueryAlter().

Overrides EntityReference_SelectionHandler_Generic::entityFieldQueryAlter

File

plugins/selection/EntityReference_SelectionHandler_Generic.class.php, line 486

Class

EntityReference_SelectionHandler_Generic_file
Override for the File type.

Code

public function entityFieldQueryAlter(SelectQueryInterface $query) {

  // Core forces us to know about 'permanent' vs. 'temporary' files.
  $tables = $query
    ->getTables();
  $base_table = key($tables);
  $query
    ->condition('status', FILE_STATUS_PERMANENT);

  // Access control to files is a very difficult business. For now, we are not
  // going to give it a shot.
  // @todo: fix this when core access control is less insane.
  return $query;
}