protected function AssetFileEntityHelper::drupalFileSaveData in Media: Acquia DAM 8
Saves a file to the specified destination and creates a database entry.
This method exists so the functionality can be overridden in unit tests.
Parameters
string $data: A string containing the contents of the file.
string|null $destination: (optional) A string containing the destination URI. This must be a stream wrapper URI. If no value or NULL is provided, a randomized name will be generated and the file will be saved using Drupal's default files scheme, usually "public://".
Return value
\Drupal\file\FileInterface|false A file entity, or FALSE on error.
1 call to AssetFileEntityHelper::drupalFileSaveData()
- AssetFileEntityHelper::createNewFile in src/
Service/ AssetFileEntityHelper.php - Creates a new file for an asset.
File
- src/
Service/ AssetFileEntityHelper.php, line 365
Class
- AssetFileEntityHelper
- Class AssetFileEntityHelper.
Namespace
Drupal\media_acquiadam\ServiceCode
protected function drupalFileSaveData($data, $destination = NULL) {
return file_save_data($data, $destination, FileSystemInterface::EXISTS_REPLACE);
}