diff --git a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php index 8ccb12b..021b7ac 100644 --- a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php +++ b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php @@ -39,18 +39,27 @@ public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): strin { $resolver = $this->innerMapper->mapToFieldValueResolver($fieldDefinition); + //we make sure no "field" (case insensitive) keyword in the actual field's identifier gets replaced + //only syntax like: '@=resolver("MatrixFieldValue", [value, "field_matrix"])' needs to be taken into account + //where [value, "field_matrix"] stands for the actual field's identifier + if (preg_match('/value, "(.*field.*)"/i', $resolver) !== 1) { + $resolver = 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 );