Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8309: the order of str_replace execution has been changed to match what was before the changes #65

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down
Loading