Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/1481 assets field filename dont import #1483

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading