0

I have two node types: 'festival', which can be translated and 'event', which untranslatable. Event has multivalued field reference to Festival, so that one Event referenced to all translated festival instances. Now I need to load Festival title depending on current user language.

global $language;    
$fest_title = $emw_event->language($language->language)->field_fest_reference->value();

returns an array of all festivals ignoring language parameter.

How to get language-specific title?

0
global $language;
$fests = $emw_event->field_fest_reference->value();
foreach ($fests as $fest) {
  if ($fest->language == $language->language) $fest_title = $fest->title;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.