You are here

public static function File::filterValidFiles in Helper 8

Filter callback; Permanent files or temporary files owned by current user.

Parameters

\Drupal\file\FileInterface $file: The file object.

Return value

bool TRUE if the file is valid, or FALSE otherwise.

File

src/File.php, line 79

Class

File
Provides helpers for working with files.

Namespace

Drupal\helper

Code

public static function filterValidFiles(FileInterface $file) {
  return $file
    ->isPermanent() || $file
    ->getOwnerId() == \Drupal::currentUser()
    ->id();
}