Pierre-Luc Posted June 25, 2014 Share Posted June 25, 2014 I’m trying to set the name field on a page through the API. Since this field has no setLanguageValue method, I’m a bit lost on what to try. Documentation doesn’t talk about this exception. Link to comment Share on other sites More sharing options...
Pierre-Luc Posted June 25, 2014 Author Share Posted June 25, 2014 Well, after a lot of fiddling, looking up the database and too much var_dump’ing, here’s the answer: if ($language->name == "default") { $page->name = $value; } else { $page->setFieldValue("name".$language->id, $value); } Where $language is a correctly queried language. 1 Link to comment Share on other sites More sharing options...
Soma Posted June 25, 2014 Share Posted June 25, 2014 Page "name" is not a field like the others. https://processwire.com/talk/topic/4720-how-to-set-page-name-in-different-languages-through-the-api/ You'd use $page->set(key, value); instead of setFieldValue() 1 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