Jump to content

setLanguageValue() doesn't work if setTrackChanges(true) isn't called before on multi language title


OpenLG
 Share

Recommended Posts

Hi,

As the title says, my code looks like this:

$aPage	 = $pages->get('selector');
$default   = $languages->get('default');
$language1 = $languages->get('language1');
$language2 = $languages->get('language2');
$aPage->setOutputFormatting(false);
$aPage->title->setTrackChanges(true); // remove this and title will be empty
$aPage->title->setLanguageValue($default,   'title');
$aPage->title->setLanguageValue($language1, 'title1');
$aPage->title->setLanguageValue($language2, 'title2');
$aPage->save();

The reason I'm asking is I can't find any mention of this in the documentation and it took quite some time to figure out.

Link to comment
Share on other sites

Thanks for finding this elitLG! As you probably guessed, that's not the intended behavior-- you shouldn't have to calls setTrackChanges on your own. Thanks for the good example, I was able to duplicate here as well. I have updated the fieldtypeWakeupValue hook function in LanguageSupportFields.module to have the setTrackChanges(true) so that you don't need to do the above. This is now in the dev branch where it'll run through a little more testing just to make sure there aren't any side effects.

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

×
×
  • Create New...