public function PhotosUpload::path in Album Photos 6.0.x
Same name and namespace in other branches
- 8.5 src/PhotosUpload.php \Drupal\photos\PhotosUpload::path()
- 8.4 src/PhotosUpload.php \Drupal\photos\PhotosUpload::path()
Temporary file path.
The image file path is now handled in the field settings. This is used if needed before the field settings are triggered.
Parameters
string $schemaType: A string with the URL alias to clean up.
Return value
string The cleaned URL alias.
Overrides PhotosUploadInterface::path
1 call to PhotosUpload::path()
- PhotosUpload::unzip in src/
PhotosUpload.php - Unzip archive of image files.
File
- src/
PhotosUpload.php, line 191
Class
- PhotosUpload
- Functions to help with uploading images to albums.
Namespace
Drupal\photosCode
public function path($schemaType = 'default') {
$fileConfig = $this->configFactory
->get('system.file');
$path[] = 'photos';
switch ($schemaType) {
case 'private':
$scheme = 'private';
break;
case 'public':
$scheme = 'public';
break;
case 'default':
default:
$scheme = $fileConfig
->get('default_scheme');
break;
}
$dirs = [];
// Prepare directory.
foreach ($path as $folder) {
$dirs[] = $folder;
$finalPath = $scheme . '://' . implode('/', $dirs);
if (!$this->fileSystem
->prepareDirectory($finalPath, FileSystemInterface::CREATE_DIRECTORY)) {
return FALSE;
}
}
if ($finalPath) {
// Make sure the path does not end with a forward slash.
$finalPath = rtrim($finalPath, '/');
}
return $finalPath;
}