Christian Posted July 11, 2014 Share Posted July 11, 2014 I'm in a process of saving a multi lingual site. The problem is, it only save on the default language of the user. And not the other language. Code: public function hookSave(HookEvent $event) { // GET PAGE DATA $page = $event->arguments[0]; // CHECK IF PAGE USE PAGE REVISIONS TEMPLATE $children = $page->children("template=pending-revisions"); if( count($children) != 0 ) { $p = new Page(); $p->template = 'home'; $p->parent = wire('pages')->get($children[0]->path()); $p->title = 'Sample Revise'; $p->name = 'Sample Revise'; $p->site_meta_description = 'Sample Revise'; $p->site_headline = 'Sample Revise'; $p->site_sub_headline = 'Sample Revise'; $p->body = 'Sample Revise'; $p->save(); } // die(); } Link to comment Share on other sites More sharing options...
Christian Posted July 14, 2014 Author Share Posted July 14, 2014 Fixed. I just have to add curly braces. foreach( $page->fields as $field ) { if( ! in_array($field->type, $ignore_field_type) ) { $field_name = $field->name; $revise_page->{$field_name} = $page->get($field->name); } } I just changed the field name to dynamic so you might just enclosed static field name to curly braces. 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