2

localeEnabled(false) does not seem to do anything or I'm misunderstanding its use.

I'm on Craft 2.6 and have this code:

{% for region in Craft.entries.section('handle').level(1).localeEnabled(false) %}

This section is a structure with 3 top level categories which are enabled or disabled for certain languages.
If I'm viewing the site in the Spanish locale for example, I'm only seeing the entries that have Spanish enabled, because they're automatically filtered by Craft to my current Locale as is how Craft works.

So I thought, localeEnabled(false) would get all of the entries in all locales.
But unfortunately, it doesn't work...

Is this a bug or do I misunderstand the function of that command? The explanation in the docs really read as if my understanding of the function is correct.

1 Answer 1

1

It's a bit awkward, but you're understanding is correct. My guess is you probably need to add a .status(null) to take into account the elements global status as well. localeEnabled, by itself, just checks the element's locale status.

2
  • That works idd! So if I understand correctly, the localeEnabled only checks if the entry is enabled for the current locale? So if it would be disabled for Spanish, with localeEnabled(false) it would also show the entry on the Spanish site? Commented Apr 4, 2017 at 20:08
  • @TomDeSmet Yessir.
    – Brad Bell
    Commented Apr 4, 2017 at 21:13

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.