Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
18 changes: 16 additions & 2 deletions administrator/components/com_media/src/Model/ApiModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public function getFile($adapter, $path = '/', $options = [])
$file->path = $adapter . ":" . $file->path;
$file->adapter = $adapter;

Factory::getApplication()->triggerEvent('onFetchMediaFile', [$file]);

return $file;
}

Expand Down Expand Up @@ -178,8 +180,12 @@ public function getFiles($adapter, $path = '/', $options = [])
$file->adapter = $adapter;
}

$files = array_values($files);

Factory::getApplication()->triggerEvent('onFetchMediaFiles', [$files]);

// Return array with proper indexes
return array_values($files);
return $files;
}

/**
Expand Down Expand Up @@ -454,7 +460,15 @@ public function getUrl($adapter, $path)
throw new InvalidPathException;
}

return $this->getAdapter($adapter)->getUrl($path);
$url = $this->getAdapter($adapter)->getUrl($path);
$newUrl = Factory::getApplication()->triggerEvent('onFetchMediaFileUrl', [$url]);

if ($newUrl && $newUrl !== false)
{
$url = $newUrl;
}

return $url;
}

/**
Expand Down