Skip to content

Conversation

@vermario
Copy link

@vermario vermario commented Nov 2, 2017

Without this, endpoints exposing nodes will return nodes of all languages, even if the endpoint is called with a language prefix for example.

This small change allows to filter the nodes by the language prefix, which is what we need in our use case, and also it seems some other people in the issue queue: #980 for example.

Should we merge this then?

@e0ipso
Copy link
Member

e0ipso commented Nov 9, 2017

I'm hesitant to merge this since I can see the opposite argument for this feature.

@vermario
Copy link
Author

vermario commented Nov 10, 2017

hi! First of all, great module!

I understand the problem, and there are 2 other solutions that I tried to get to what I need:

  • you can add a "language" public field and add then a filter for that: the problem I see there is that then the request has the default language set (In my case, finnish) and if you load other entities as relationships (taxonomy terms) they might show up in finnish even if you have specified the fillter for english content (drupal7 has different ways to set up taxonomy terms)

  • you can create your own "LanguageNodeResource and DataProviderLanguageNode": LanguageNodeResource extends NodeResource and has the dataProviderClassName method that points to your new DataProviderLanguageNode class, that has the filtering by language like in this pull request.

At the moment I am using this second solution, instead of a patch of this pull request, because I also needed other custom stuff in "my" types of nodes.

So, this is achievable with the current module, if you are willing to code a bit yourself...

@e0ipso
Copy link
Member

e0ipso commented Nov 10, 2017

Thanks for documenting this. It may be handy for other people in your same scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants