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-7979: Fixed "field" occurrences being wrongly replaced #59

Merged
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 @@ -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
);
Expand Down
Loading