dalibor Posted September 11, 2016 Share Posted September 11, 2016 Want to check if the value of the field in nondefault lagnugage is empty (making list of transtlated and non traslated pages of websiste), but if I use $page->getLanguageValue(...) it returns the default language value when the field is empty in another language. And I don't want to turn off 'inherit value from default when empty' in fields detail settings. Anybody nows ho to do that? Thanks. Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 11, 2016 Share Posted September 11, 2016 It's probably as simple as temporarily disabling this language inheritance for each field only for the request, where you're building the list. foreach($multiLangField as $f) { $f->langBlankInherit = LanguagesPageFieldValue::langBlankInheritNone; } // Check all your fields // Make sure non of the fields is saved before exiting 4 Link to comment Share on other sites More sharing options...
kixe Posted September 12, 2016 Share Posted September 12, 2016 Great. I use this to trigger 404 by an empty field in a specific language // 404 trigger --------------------------/ $fields->get(133)->langBlankInherit = 1; $langTrigger = $page->getLanguageValue($currLang->id, 'body'); if (!$langTrigger) throw new Wire404Exception(); Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now