Skip to content

Commit

Permalink
Stop including the temp volume in “all sources” for Assets fields
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jan 23, 2024
1 parent 627cc53 commit 97a08f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/fields/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,14 @@ public function getInputSources(?ElementInterface $element = null): array|string
$sources = array_merge($this->sources);
} else {
$sources = [];
[$tempVolume] = Craft::$app->getAssets()->getTempVolumeAndSubpath();
$tempVolumeKey = $tempVolume ? "volume:$tempVolume->uid" : null;

foreach (Craft::$app->getElementSources()->getSources(Asset::class) as $source) {
if ($source['type'] !== ElementSources::TYPE_HEADING) {
if (
$source['type'] !== ElementSources::TYPE_HEADING &&
$source['key'] !== $tempVolumeKey
) {
$sources[] = $source['key'];
}
}
Expand Down

0 comments on commit 97a08f8

Please sign in to comment.