protected function DemoImage::findExistingFile in Panopoly Core 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 src/
Plugin/ migrate/ process/ DemoImage.php - Finds existing or creates a new file.
File
- 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\processCode
protected function findExistingFile($uri) {
$files = $this->fileStorage
->loadByProperties([
'uri' => $uri,
]);
if (!empty($files)) {
return reset($files);
}
return NULL;
}