Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve the SaveMediaProcess
  • Loading branch information
pmPaulis committed Jun 26, 2024
commit cfaec975b515c436e51fd05058c2cb4193fa3a3a
14 changes: 9 additions & 5 deletions ProcessMaker/Models/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,17 @@ public function saveProcessMedia(Process $process, $properties, $key = 'uuid', $
// Check if exist
$exist = $process->media()->where($key, $properties[$key])->exists();
if (!$exist) {
// Define the custom properties
$customProperties = [
'media_type' => $mediaType,
'type' => $properties['type'],
];
if ($mediaType === 'slideshow') {
$customProperties['node_id'] = $properties['node_id'] ?? '';
}
// Store the images related move to MEDIA
$process->addMediaFromBase64($properties['url'])
->withCustomProperties([
'media_type' => $mediaType,
'type' => $properties['type'],
'node_id' => $properties['node_id'],
])
->withCustomProperties($customProperties)
->toMediaCollection($collectionName);
}
}
Expand Down