Is it possible to use GQL to query entries by the site *language* or query for a list of all sites? #14631
-
We want to make GQL queries that select entries by their Site's language rather than by the site handle or id. Is this possible? If not, is there a way to query for a list of all Sites, returning their id, handle, and language codes? And if that's not possible, can you recommend how we can inject some transforming PHP that lives upstream of the Craft query builder and maps incoming ISO language codes to Site handles? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Good question! Neither of those are possible yet, but it does seem like you should be able to query for elements by their language. So I just added a If you need this now, you can update to the |
Beta Was this translation helpful? Give feedback.
Good question! Neither of those are possible yet, but it does seem like you should be able to query for elements by their language.
So I just added a
language
element query param (and corresponding GraphQL query argument) for Craft 4.9 and 5.0 (dcbd9a6).If you need this now, you can update to the
4.9
branch by changing yourcraftcms/cms
requirement incomposer.json
to4.9.x-dev
and runcomposer update
.