Jump to content

getLanguageValue and Repeater


horst
 Share

Recommended Posts

Hi, I have read in a thread that one can access other language versions from a LanguageTextfield with

$myField->->getLanguageValue($language->id);

Unfortunately it doesn't work when the LanguageField is within a Repeater.

Is this, because the class that serves the getLanguageValue function is LanguagesPageFieldValue , and within a Repeater a Textfield isn't a PageField?

And is there a alternative solution ?

Link to comment
Share on other sites

It actually shouldn't matter whether it's in a repeater or not. Repeaters don't change the type of any fields. But your code above has "->->" which looks like a typo? The nice thing about repeaters is that they really aren't anything more than a regular PageArray like any other. 

And is there a alternative solution ?

An alternative is to set $user->language to the language you want the field to return its value in, before you retrieve the value. Then return $user->language back to the language it was before. 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...