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

[4.x] property_path DataProducer resolver function fetchDataByPropertyPath() does not pass language parameter #1380

Open
kevinsiji opened this issue Nov 21, 2023 · 0 comments
Labels

Comments

@kevinsiji
Copy link

kevinsiji commented Nov 21, 2023

While querying paragraph content in translated languages, found that property_path DataProducer resolve calls the function fetchDataByPropertyPath() at line 69 of graphql/src/Plugin/GraphQL/DataProducer/TypedData/PropertyPath.php, but does not pass the language parameter.

I tried to pass the language as 4th parameter, but it fails in the module typed_data/src/DataFetcher.php at line 57 where it checks if the typed_data passed is instanceof TranslatableInterface, which results in false, hence it returns the output in default language.

I work around this by below code in public function resolve in PropertyPath.php

$context_lang = $value->getValue()->language()->getId();
if ($output instanceof TranslatableInterface && $output->hasTranslation($context_lang)) {
  $output = $output->getTranslation($context_lang);
}
@kevinsiji kevinsiji changed the title property_path DataProducer resolver function fetchDataByPropertyPath() does not pass language parameter [4.x] property_path DataProducer resolver function fetchDataByPropertyPath() does not pass language parameter Nov 21, 2023
@Kingdutch Kingdutch added the 4.x label Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants