Jump to content

Strange behaviour with selector title!='' and language-alternate title field


Recommended Posts

Hi there,

i have a selector that goes like this:

$pages->find("has_parent!=2,created<$ts,title=''");

This has worked fine in the past and should get me certain pages that are older than a certain period ($ts) and have an empty title (happens in a circumstance).

However I have no installed Languages Support - Fields. This is only because in ONE Template I wanted to have a language alternate title. I called this field "title_german" and it works as expected.

However: Suddenly the above selector gives me ALL the pages that do not have the field "title_german" filled IF the user has German as his language. In English, everything is fine. 

First of all: Only one template has "title_german" the others only have "title" and it is certainly not empty. Still, they all get selected.
Second of all: Shouldn't looking for "title" in a selector check "title_german" first and if that is empty fallback to "title"? 

I mean, I could check the user language and modify my selector to "title_german" but what if "title_german" is empty and "title" is not?

Any idea how to do this? What did I do wrong? 

Thanks for any input. Sascha

Link to comment
Share on other sites

1 hour ago, saschapi said:

However: Suddenly the above selector gives me ALL the pages that do not have the field "title_german" filled IF the user has German as his language. In English, everything is fine. 

Did you perform an ProcessWire upgrade recently? Otherwise something else must have changed.

 

I know that in multilanguage setups you can create fields like this: image, image_de, image_es to have multilanguage image support - so I assume ignoring the _german part here might be a feature actually.

Maybe changing the field name to title-german would already help, but DON'T try this in your prod environment.

Might test it later in my testing environment.

Update: tried and tried, yet can't really reproduce this issue here. 🤔

Edited by wbmnfktr
added updated
Link to comment
Share on other sites

1 hour ago, wbmnfktr said:

Did you perform an ProcessWire upgrade recently? Otherwise something else must have changed.

With "suddenly" I meant after installing language support field. After I uninstalled it the selector worked again. 

Point is: it shouldn't be a feature if alternate language field is used. At least to my understanding. 

Might need to test some more on my site. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...