Michiel Auerbach Posted August 21, 2013 Share Posted August 21, 2013 Hi there, Surfed the Forum, but couldn't find an answer to my problem :-s I have two languages and want to show a field ONLY when it has a value in the correct language; For the default language I can create a simple check offcourse ($page->fieldname = '') But how about the alternate language (Let's say Dutch 1017) To make things more complex, I use this in a sub-function so the main variables of PW aren't arround. Any ideas?Michiel Link to comment Share on other sites More sharing options...
Wanze Posted August 21, 2013 Share Posted August 21, 2013 Hi Michiel, Easiest solution would be to use the latest dev version of ProcessWire. There's a setting in each text field which is configured as multilang under the "Details" tab: Language Support / Blank behaviour What should happen when this field's value is blank? [ ] Inherit value from default language [x] Remain Blank Choose "Remain Blank" should fix your problem. 2 Link to comment Share on other sites More sharing options...
Michiel Auerbach Posted August 26, 2013 Author Share Posted August 26, 2013 Hey Wanze, thnx for the support Didn't get a notice so I actually forgot to check here #shame...Good idea, problem is at this stage PW is beeing used by a major company (bank) and don't really want to use a dev-version (how stable it may be) Any other ones?? Link to comment Share on other sites More sharing options...
apeisa Posted August 26, 2013 Share Posted August 26, 2013 Wait for 2.4 release, which is pretty soon. 2 Link to comment Share on other sites More sharing options...
Soma Posted August 26, 2013 Share Posted August 26, 2013 In a subfunction they aren't available? wire("languages") ? Is available everywhere. But how about the alternate language (Let's say Dutch 1017) this should maybe work. $lang = $languages->get("dutch"); $dutch_field = $page->get("fieldname$lang"); or $lang = $user->language; $user->language = $languages->get("dutch"); if($page->fieldname) { ... } $user->language = $lang; Link to comment Share on other sites More sharing options...
Michiel Auerbach Posted August 26, 2013 Author Share Posted August 26, 2013 Wait for 2.4 release, which is pretty soon. Apeisa, good idea but I need the fix sooner than 2.4 (although there are some really great features in 2.4 that we love Soma - Thnx that is a great idea that I didn't try yet... Thnx! Link to comment Share on other sites More sharing options...
Michiel Auerbach Posted September 9, 2013 Author Share Posted September 9, 2013 So for our own website I want to use the latest dev-version (2.3.1) or 2.4. Any idea on when 2.4 is going to be released? Link to comment Share on other sites More sharing options...
ryan Posted September 13, 2013 Share Posted September 13, 2013 2.4 will be released once the dev branch source has sat for a week or so without any necessary fixes or major additions (meaning, it's reached a stable state). I think that's probably soon, but don't want to promise any dates since I'm actively working on the code almost every day. 5 Link to comment Share on other sites More sharing options...
dragan Posted October 29, 2013 Share Posted October 29, 2013 edit: well, that was easy $f = $fields->get("title"); $f->set("langBlankInherit", 1); $f->save(); I'll keep it here, in case someone else searches for the same thing... Is there an API function to change the language support blank behaviour? e.g. change the behaviour of dozens of multilang fields via API? (from "show default language" to "blank" or vice versa). I see in the DB-table "fields" an entry like this: "langBlankInherit":1 (field "data"), when set to remain blank... (Using dev version 2.3.2) 3 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