From 46a884c4505fd57e54f5279996175fd73e49a1f4 Mon Sep 17 00:00:00 2001 From: Iwona Just Date: Wed, 17 Jul 2024 11:08:41 +0200 Subject: [PATCH 1/2] filenames can be empty - don't freak out --- src/fields/Assets.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fields/Assets.php b/src/fields/Assets.php index a1bdd27f..09978fed 100644 --- a/src/fields/Assets.php +++ b/src/fields/Assets.php @@ -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([ From d4f40750f6c314b83b7f874fffd97d81be6ecdc0 Mon Sep 17 00:00:00 2001 From: Iwona Just Date: Wed, 17 Jul 2024 11:09:00 +0200 Subject: [PATCH 2/2] remove usedefault from assets field filename dropdown --- src/templates/_includes/fields/assets.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/_includes/fields/assets.html b/src/templates/_includes/fields/assets.html index 1e49b21b..eb94839f 100644 --- a/src/templates/_includes/fields/assets.html +++ b/src/templates/_includes/fields/assets.html @@ -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', }) }}