horst Posted February 26, 2021 Share Posted February 26, 2021 (edited) Hi, I use a saveReady Hook and want to set values of the name field according to values from other fields. But only the name field of the default language is updated, regardless of the language the user is in. When saving via API scripts, the result is the same as when saving interactive via page editor. My code is as follows: $this->pages->addHookAfter('saveReady', function($event) { $p = $event->arguments[0]; $lang_DE = $event->wire->languages->get(1016); $lang_EN = $event->wire->languages->get(1018); $newName_DE = 'ein-generischer-neuer-name'; $newName_EN = 'a-genric-new-name'; $p->setLanguageValue($lang_DE, 'name', $newName_DE); $p->setLanguageValue($lang_EN, 'name', $newName_EN); } How can I set (andSave) the other language name too in a saveReady Hook? Or do I need to use another hook for that? EDIT: The above code works as expected. It was interfering with special scripts / hooks on my development site. ? Edited February 26, 2021 by horst solved ! 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