Skip to content

Commit

Permalink
Merge pull request #1483 from craftcms/bugfix/1481-assets-field-filen…
Browse files Browse the repository at this point in the history
…ame-dont-import

Bugfix/1481 assets field filename dont import
  • Loading branch information
angrybrad authored Jul 18, 2024
2 parents 890e001 + d4f4075 commit 0263669
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/fields/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ public function parseField(): mixed
$base64ToUpload = [];

$filenamesFromFeed = $upload ? DataHelper::fetchArrayValue($this->feedData, $this->fieldInfo, 'options.filenameNode') : null;
// see https://github.com/craftcms/feed-me/issues/1471
$filenamesFromFeed = array_splice($filenamesFromFeed, $nodeKey, count($value));
if ($filenamesFromFeed) {
// see https://github.com/craftcms/feed-me/issues/1471
$filenamesFromFeed = array_splice($filenamesFromFeed, $nodeKey, count($value));
}

// Fire an 'onAssetFilename' event
$event = new AssetFilenameEvent([
Expand Down
2 changes: 1 addition & 1 deletion src/templates/_includes/fields/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
label: 'Use this filename for assets created from URL:'|t('feed-me'),
name: 'options[filenameNode]',
value: hash_get(feed.fieldMapping, optionsPath ~ '.filenameNode') ?: '',
options: feedData,
options: feedData|filter(option => option.value != 'usedefault'),
class: 'selectize fullwidth',
}) }}
</div>
Expand Down

0 comments on commit 0263669

Please sign in to comment.