class EntityReference_SelectionHandler_Generic_file in Entity reference 7
Override for the File type.
This only exists to workaround core bugs.
Hierarchy
- class \EntityReference_SelectionHandler_Generic implements EntityReference_SelectionHandler
Expanded class hierarchy of EntityReference_SelectionHandler_Generic_file
File
- plugins/selection/ EntityReference_SelectionHandler_Generic.class.php, line 485 
View source
class EntityReference_SelectionHandler_Generic_file extends EntityReference_SelectionHandler_Generic {
  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;
  }
  public function getLabel($entity) {
    // The file entity doesn't have a label. More over, the filename is
    // sometimes empty, so use the basename in that case.
    return $entity->filename !== '' ? $entity->filename : basename($entity->uri);
  }
} 
      