update AG Posted January 17, 2024 Share Posted January 17, 2024 The following code allows us to define multiple fallbacks for multilanguage fields. But somehow it doesn't work for fields with the Fieldtype "FieldtypeTable". $wire->addHookAfter('LanguagesPageFieldValue::getStringValue', function(HookEvent $event) { $mlObj = $event->object; // LanguagesPageFieldValue object $currPage = wire('page'); $french = wire('languages')->get(1033); $german = wire('languages')->get(1130); $italian = wire('languages')->get(1131); $russian = wire('languages')->get(1132); if($currPage->template->name == "job" || $currPage->template->name == "news" || $currPage->template->name == "doctor") { // Take the first non-empty value in order of precedence: foreach(array(wire('user')->language, $french, $german, $italian, $russian, wire('languages')->getDefault()) as $lang) { $newLangValue = $mlObj->getLanguageValue($lang); if($newLangValue != "") break; } $event->return = $newLangValue; } }); Inside the table field I am using this multilanguage field. What can I do to make it also work for multilanguage fields defined inside table fields? PW Version: 3.0.229 PHP Version: 8.0 ProFields Table Version: 0.2.2 KR Orkun 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