Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
rratsun committed Jan 23, 2023
1 parent 8a48311 commit 2da9e1e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/Repositories/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ public function createAsset(Entity $attachment, bool $skipValidation = false, st
$asset->set('private', $this->getConfig()->get('isUploadPrivate', true));
$asset->set('fileId', $attachment->get('id'));
if (!empty($type)) {
$options = $this->getMetadata()->get(['entityDefs', 'Asset', 'fields', 'type', 'options'], []);
$optionsIds = $this->getMetadata()->get(['entityDefs', 'Asset', 'fields', 'type', 'optionsIds'], []);

$key = array_search($type, $options);
if ($key !== false && isset($optionsIds[$key])) {
$type = $optionsIds[$key];
}

$asset->set('type', [$type]);
if (!$skipValidation) {
try {
Expand Down

0 comments on commit 2da9e1e

Please sign in to comment.