You are here

public function SelectionEntityTypeFile::entityFieldQueryAlter in Entity reference 8

Implements EntityReferenceHandler::entityFieldQueryAlter().

Overrides SelectionBase::entityFieldQueryAlter

File

lib/Drupal/entityreference/Plugin/Type/Selection/SelectionEntityTypeFile.php, line 19
Definition of Drupal\entityreference\Plugin\entityreference\selection\SelectionEntityTypeFile.

Class

SelectionEntityTypeFile

Namespace

Drupal\entityreference\Plugin\Type\Selection

Code

public function entityFieldQueryAlter(AlterableInterface $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;
}