protected function AcquiadamAssetDataTrait::generateNewVersion in Media: Acquia DAM 8
Create a new version of a given asset.
Parameters
\cweagans\webdam\Entity\Asset $asset: The asset to be updated.
Return value
\cweagans\webdam\Entity\Asset The updated asset.
2 calls to AcquiadamAssetDataTrait::generateNewVersion()
- AcquiadamMediaTest::saveNewVersion in tests/
src/ Kernel/ AcquiadamMediaTest.php - Generates a new version of the asset and resaves media entity.
- AcquiadamNotificationTest::generateNewVersionAndNotify in tests/
src/ Kernel/ AcquiadamNotificationTest.php - Updates an Asset and add notification to it.
File
- tests/
src/ Traits/ AcquiadamAssetDataTrait.php, line 107
Class
- AcquiadamAssetDataTrait
- Shared asset data.
Namespace
Drupal\Tests\media_acquiadam\TraitsCode
protected function generateNewVersion(Asset $asset) {
$asset->version++;
$filename_parts = explode('.', $asset->filename);
$asset->filename = $filename_parts[0] . '_version_' . $asset->version . '.' . $filename_parts[1];
return $asset;
}