Skip to content

Commit

Permalink
Merge branch '5.x' into 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
angrybrad committed Feb 6, 2025
2 parents 119c1d8 + cb16c76 commit 1dc9d4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
- Improved the experience of mapping relational fields with individual field instances in Craft 5. ([#1585](https://github.com/craftcms/feed-me/issues/1585))
- Feed Me settings are now only available to admins and when `allowAdminChanges` is set to `true`. ([#1581](https://github.com/craftcms/feed-me/pull/1581))
- Added support for `formatted` and `raw` subfields in the Google Maps plugin. ([#1587](https://github.com/craftcms/feed-me/pull/1587))
- Fixed an issue where empty values were not respected for inner-element fields when `setEmptyValues` is set to `true`. ([#1590](https://github.com/craftcms/feed-me/pull/1590))
- Fixed a bug where empty values were not respected for inner-element fields when `setEmptyValues` is set to `true`. ([#1590](https://github.com/craftcms/feed-me/pull/1590))
- Fixed a bug where values with an empty string would not be treated as empty if `setEmtpyValues` is set to `true`. ([#1591](https://github.com/craftcms/feed-me/pull/1591))

## 6.6.1 - 2024-12-01

Expand Down
9 changes: 6 additions & 3 deletions src/fields/DefaultField.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ public function parseField(): mixed
$value = $this->field->normalizeValue($value, $this->element);
}

// if we're setting empty values and the value is an empty string - return it
// if we're setting empty values and the value is empty - return an empty string
// otherwise HtmlField will serialize it to null, and we setEmptyValues won't take effect
// https://github.com/craftcms/feed-me/issues/1321
if ($this->feed['setEmptyValues'] === 1 && $value === '') {
return $value;
// if the normalizeValue above returns null, which can happen for e.g. plain text field and a value of a single space
// we also need to ensure that an empty string is returned, not the value as that can be null after normalization
// https://github.com/craftcms/feed-me/issues/1560
if ($this->feed['setEmptyValues'] === 1 && empty($value)) {
return '';
}

// Lastly, get each field to prepare values how they should
Expand Down

0 comments on commit 1dc9d4a

Please sign in to comment.