diff --git a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php index 8ccb12b..7ae00d0 100644 --- a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php +++ b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php @@ -39,18 +39,25 @@ public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): strin { $resolver = $this->innerMapper->mapToFieldValueResolver($fieldDefinition); + //making sure we won't be replacing "field" occurrences in the actual field's name + if (preg_match('/"(.*field.*)"/', $resolver) !== 1) { + return str_replace( + 'field', + 'resolver("ItemFieldValue", [value, "' . $fieldDefinition->identifier . '", args])', + $resolver + ); + } + return str_replace( [ 'content', 'location', 'item', - 'field', ], [ 'value.getContent()', 'value.getLocation()', 'value', - 'resolver("ItemFieldValue", [value, "' . $fieldDefinition->identifier . '", args])', ], $resolver );