0

My website has articles. Each article has a field 'region restricted' (default is OFF). I want to on my view display all articles which is not restricted but also show articles that are restricted and has a translation in the active language the website is currently set to.

For example, if the site is currently set to french, show me all articles regardless of translation where the region restriciton is off but also include in the dataset articles that are region restricted and has a translation for french. I am even happy to not work on translations but say outright that the article must have no restrictions, the language must just be set to french.

My view criteria is as follows. As things stand now, I am not returning any articles except for 1 article when I have selected french as my language (which is also a region restricted article for french).

enter image description here

In SQL I would have assumed something like:

`... AND (`restricted`=0 OR (`restricted`=1 and `langcode`='THESITELANGUAGE'))

Can this be done? What am I doing wrong?

2
  • Did you add field restricted later on? If you add a new field later on, older, pre-exisiting nodes will not magically get values from new fields. Until you save them at least once, old nodes' restricted will be NULL, which is not the same as number 0
    – Hudri
    Commented Mar 7, 2022 at 15:16
  • I did yes and that was the solution :)
    – mauzilla
    Commented Mar 9, 2022 at 8:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.