You are here

protected function FileImport::getDestinationFilePath in Migrate Files (extended) 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/migrate/process/FileImport.php \Drupal\migrate_file\Plugin\migrate\process\FileImport::getDestinationFilePath()

Build the destination filename.

Parameters

string $source: The source URI.

string $destination: The destination URI.

Return value

boolean Whether or not the file exists.

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

File

src/Plugin/migrate/process/FileImport.php, line 347

Class

FileImport
Imports a file from an local or external source.

Namespace

Drupal\migrate_file\Plugin\migrate\process

Code

protected function getDestinationFilePath($source, $destination) {
  if ($this
    ->isDirectory($destination)) {
    $parsed_url = parse_url($source);
    $filepath = $destination . \Drupal::service('file_system')
      ->basename($parsed_url['path']);
  }
  else {
    $filepath = $destination;
  }
  return $filepath;
}