Skip to content

Commit

Permalink
Merge branch '6.x' into bugfix/1427-generate-url-no-fs
Browse files Browse the repository at this point in the history
  • Loading branch information
angrybrad authored May 1, 2024
2 parents bedc893 + ce96cff commit c6ee901
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Unreleased

- Fixed a bug when importing Assets ([#1427](https://github.com/craftcms/feed-me/pull/1427))
- Fixed a PHP error that would occur when importing Assets ([#1427](https://github.com/craftcms/feed-me/pull/1427))
- Fixed a PHP error that could occur when importing into an entry type with a hidden title attribute. ([#1423](https://github.com/craftcms/feed-me/pull/1423))

## 6.0.0 - 2024-03-19

Expand Down
20 changes: 11 additions & 9 deletions src/fields/Matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,15 @@ public function parseField(): mixed
$fieldData[$key] = $parsedValue;
}
}
foreach ($fields['attributes'] as $fieldHandle => $fieldInfo) {
$node = Hash::get($fieldInfo, 'node');
if ($node === 'usedefault') {
$key = $this->_getBlockKey($nodePathSegments, $blockHandle, $fieldHandle);

$parsedValue = DataHelper::fetchSimpleValue($this->feedData, $fieldInfo);
$attributeData[$key] = $parsedValue;
if ($attributeInfo) {
foreach ($fields['attributes'] as $fieldHandle => $fieldInfo) {
$node = Hash::get($fieldInfo, 'node');
if ($node === 'usedefault') {
$key = $this->_getBlockKey($nodePathSegments, $blockHandle, $fieldHandle);

$parsedValue = DataHelper::fetchSimpleValue($this->feedData, $fieldInfo);
$attributeData[$key] = $parsedValue;
}
}
}
}
Expand Down Expand Up @@ -257,7 +259,7 @@ private function _getBlockKey(array $nodePathSegments, string $blockHandle, stri
private function _getFieldMappingInfoForNodePath($nodePath, $blocks): ?array
{
foreach ($blocks as $blockHandle => $blockInfo) {
$fields = Hash::get($blockInfo, 'fields');
$fields = Hash::get($blockInfo, 'fields', []);

$feedPath = preg_replace('/(\/\d+\/)/', '/', $nodePath);
$feedPath = preg_replace('/^(\d+\/)|(\/\d+)/', '', $feedPath);
Expand Down Expand Up @@ -304,7 +306,7 @@ private function _getFieldMappingInfoForNodePath($nodePath, $blocks): ?array
private function _getAttributeMappingInfoForNodePath($nodePath, $blocks): ?array
{
foreach ($blocks as $blockHandle => $blockInfo) {
$fields = Hash::get($blockInfo, 'attributes');
$fields = Hash::get($blockInfo, 'attributes', []);

$feedPath = preg_replace('/(\/\d+\/)/', '/', $nodePath);
$feedPath = preg_replace('/^(\d+\/)|(\/\d+)/', '', $feedPath);
Expand Down

0 comments on commit c6ee901

Please sign in to comment.