protected function AssetFileStorage::internalFileUri in Asset Injector 8
Same name and namespace in other branches
- 8.2 src/AssetFileStorage.php \Drupal\asset_injector\AssetFileStorage::internalFileUri()
Create internal file URI or pattern.
Parameters
bool $pattern: Get Pattern instead of internal file URI.
Return value
string File uri.
2 calls to AssetFileStorage::internalFileUri()
- AssetFileStorage::createFile in src/
AssetFileStorage.php - Create file and return internal uri.
- AssetFileStorage::deleteFiles in src/
AssetFileStorage.php - Delete files for an asset.
File
- src/
AssetFileStorage.php, line 83
Class
- AssetFileStorage
- Class AssetFileStorage.
Namespace
Drupal\asset_injectorCode
protected function internalFileUri($pattern = FALSE) {
$name = $this->asset
->id();
$extension = $this->asset
->extension();
$hash = $pattern ? '*' : md5($this->asset
->getCode());
$all_assets_directory = self::internalDirectoryUri();
if ($pattern) {
// glob() does not understand stream wrappers. Sigh.
$all_assets_directory = \Drupal::service('file_system')
->realpath($all_assets_directory);
}
$internal_uri = "{$all_assets_directory}/{$extension}/{$name}-{$hash}.{$extension}";
return $internal_uri;
}