You are here

protected function DemoImage::findOrCreateFile in Panopoly Core 8.2

Finds existing or creates a new file.

Parameters

string $source_path: The source path.

string $destination_path: The destination path.

Return value

\Drupal\file\FileInterface The file that was found or created.

Throws

\Drupal\migrate\MigrateException

1 call to DemoImage::findOrCreateFile()
DemoImage::transform in src/Plugin/migrate/process/DemoImage.php
Performs the associated process.

File

src/Plugin/migrate/process/DemoImage.php, line 211

Class

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

Namespace

Drupal\panopoly_core\Plugin\migrate\process

Code

protected function findOrCreateFile($source_path, $destination_path) {
  $file = $this
    ->findExistingFile($destination_path);
  if (!$file) {
    $file = $this
      ->createFile($source_path, $destination_path);
  }
  return $file;
}