diff --git a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php index 021b7ac..97c3ede 100644 --- a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php +++ b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php @@ -38,19 +38,7 @@ public function mapToFieldValueType(FieldDefinition $fieldDefinition): string public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): string { $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( + $resolver = str_replace( [ 'content', 'location', @@ -63,6 +51,19 @@ public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): strin ], $resolver ); + + //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 $resolver; } public function mapToFieldValueInputType(ContentType $contentType, FieldDefinition $fieldDefinition): ?string