You are here

protected function DemoImage::findExistingFile in Panopoly 8.2

Gets an existing file entity if there is one.

Parameters

string $uri: The file URI (path).

Return value

\Drupal\file\FileInterface|null The file or NULL.

1 call to DemoImage::findExistingFile()
DemoImage::findOrCreateFile in modules/panopoly/panopoly_core/src/Plugin/migrate/process/DemoImage.php
Finds existing or creates a new file.

File

modules/panopoly/panopoly_core/src/Plugin/migrate/process/DemoImage.php, line 137

Class

DemoImage
Process plugin for creating demo images from files in the module.

Namespace

Drupal\panopoly_core\Plugin\migrate\process

Code

protected function findExistingFile($uri) {
  $files = $this->fileStorage
    ->loadByProperties([
    'uri' => $uri,
  ]);
  if (!empty($files)) {
    return reset($files);
  }
  return NULL;
}