You are here

protected function JsonWriterTrait::createDirTreeForFileDest in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Base/JsonWriterTrait.php \Drupal\content_synchronizer\Base\JsonWriterTrait::createDirTreeForFileDest()
  2. 3.x src/Base/JsonWriterTrait.php \Drupal\content_synchronizer\Base\JsonWriterTrait::createDirTreeForFileDest()

Create a directory tree.

2 calls to JsonWriterTrait::createDirTreeForFileDest()
FileProcessor::addFileToAssets in src/Plugin/content_synchronizer/entity_processor/FileProcessor.php
Add file to assets dir.
FileProcessor::getEntityToImport in src/Plugin/content_synchronizer/entity_processor/FileProcessor.php
Return the entity to import.

File

src/Base/JsonWriterTrait.php, line 46

Class

JsonWriterTrait
Json writer tool.

Namespace

Drupal\content_synchronizer\Base

Code

protected function createDirTreeForFileDest($destination, $root = '/') {
  $destinationItems = explode('/', $destination);
  $fileName = array_pop($destinationItems);

  // Create destination tree.
  foreach ($destinationItems as $dirItem) {
    $root .= '/' . $dirItem;
    $this
      ->createDirectory($root);
  }
  return $root . '/' . $fileName;
}