Search the Community
Showing results for tags 'select options fieldtype'.
-
I have an array of bilingual pages. These pages have a body. If the body is filled, it's in the array. So the array is different in english than in german. Criteria is the body. I want to change that though and use a SelectOptions field as criteria instead. That field would be a multiple value checkbox SelectOptions field with values as follows. 1=English 2=Deutsch Now I want to check one or two of these options for each page via API. Something like: foreach ($suckers as $s) { // :D if (user()->language->title == 'Deutsch') { $s->of(false); if ($s->cast_language == "") { $s->cast_language = "2"; } elseif ($s->cast_language == "1") { $s->cast_language = "1|2"; } $s->cast_language->items->add(1); $s->save(); $s->of(true); } if (user()->language->title == 'English') { $s->of(false); if ($s->cast_language == "") { $s->cast_language = "1"; } elseif ($s->cast_language == "2") { $s->cast_language = "1|2"; } $s->cast_language->items->add(1); $s->save(); $s->of(true); } } But I think that's nonsense, still cannot tell from the documentation how to approach this. The issue is, the array depends on the user's current language, so in order to use this function to set the values right I need to run it once in German and once in English. But at the second run it will overwrite the values of the first run. Don't know how to add to the array of selected options. Thanks for help!
-
I have a problem that my Select Options Field doesnt change the language on the frontend, when I am changing the language on the frontend. My Field Settings looks like this But the Frontend shows me always the default language when accesssing these urls ... www.domain.com/form www.domain.com/de/form www.domain.com/it/form Why it doesnt change the language on the frontend?