public function AssetFileStorage::createFile in Asset Injector 8.2
Same name and namespace in other branches
- 8 src/AssetFileStorage.php \Drupal\asset_injector\AssetFileStorage::createFile()
Create file and return internal uri.
Return value
string Internal file URI using public:// stream wrapper.
File
- src/
AssetFileStorage.php, line 53
Class
- AssetFileStorage
- Class AssetFileStorage.
Namespace
Drupal\asset_injectorCode
public function createFile() {
$internal_uri = self::internalFileUri();
if (!is_file($internal_uri)) {
$directory = dirname($internal_uri);
$file_system = self::getFileSystemService();
$file_system
->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);
$file_system
->saveData($this->asset
->getCode(), $internal_uri, FileSystemInterface::EXISTS_REPLACE);
}
return $internal_uri;
}