lokomotivan Posted September 18, 2019 Share Posted September 18, 2019 Hey guys, i built a custom process module so i can edit pages from the custom ui. Everything works great except that multi-language page name fields does't show up in the settings tab when i edit the page from custom ui. See attached image... I use `executeEdit()` method in my module: public function executeEdit() { // breadcrumb $this->fuel->breadcrumbs->add(new Breadcrumb($this->page->url, $this->page->title)); // Execute Page Edit $processEdit = $this->modules->get('ProcessPageEdit'); return $processEdit->execute(); } Any tips? Thanks Link to comment Share on other sites More sharing options...
Zeka Posted September 18, 2019 Share Posted September 18, 2019 @lokomotivan Not sure, but try to implement WirePageEditor by your module class class YourCustomLister extends Process implements WirePageEditor 1 Link to comment Share on other sites More sharing options...
Zeka Posted September 18, 2019 Share Posted September 18, 2019 @lokomotivan public function executeEdit() { // breadcrumb $this->fuel->breadcrumbs->add(new Breadcrumb($this->page->url, $this->page->title)); // Execute Page Edit $processEdit = $this->modules->get('ProcessPageEdit'); return $processEdit->execute(); } Probably you will use something similar for adding new pages, but with ProcessPageAdd. So, by using this aproach for adding new pages you will get an issue with initial languages values. As you can see all non-default languages are active. But, after page save they become disabled. I was trying to resolve this issue but with no luck. So I went with creating addition page under the module page which reffers to custom module which extend ProcessPageAdd class ProcessCustomPageAdd extends ProcessPageAdd { /** * @return array * */ public static function getModuleInfo() { return array( 'title' => __('Page Add', __FILE__), 'summary' => __('Add a new page', __FILE__), 'version' => 108, 'permanent' => true, 'permission' => 'page-edit', 'icon' => 'plus-circle', // 'useNavJSON' => true, ); } public function init() { if ($this->wire('page')->parent->name == 'news-manager') { $this->set('parent_id', 1036); } else { ..... } } } Hope it helps. 1 Link to comment Share on other sites More sharing options...
lokomotivan Posted September 18, 2019 Author Share Posted September 18, 2019 Thanks for the tips @Zeka. Yes having same issue when creating new pages , they are inactive for all other languages. I solved this for now by checking if page is active for another language on page edit, based on language id, eg: $page->status1105 public function executeEdit() { // breadcrumb $this->fuel->breadcrumbs->add(new Breadcrumb($this->page->url, $this->page->title)); // Force activate multi-language page variations foreach($this->languages as $lng) { $id = $this->sanitizer->int($this->input->get->id); $p = $this->pages->get("id=$id"); $status_field = "status{$lng}"; if($p->{$status_field} != "" && $p->{$status_field} != 1) { $p->of(false); $p->{$status_field} = 1; $p->save(); } } // Execute Page Edit $processEdit = $this->modules->get('ProcessPageEdit'); return $processEdit->execute(); } In this case i loose ability to deactivate the page for some languages but for now i can live with it. Creating a custom add new page is also an option, /module-manager/new/, and writing a custom form for adding new pages and handle it manually. But for page edit is not so easy Link to comment Share on other sites More sharing options...
lokomotivan Posted September 18, 2019 Author Share Posted September 18, 2019 2 hours ago, Zeka said: @lokomotivan Not sure, but try to implement WirePageEditor by your module class class YourCustomLister extends Process implements WirePageEditor This solved the issue. Was busting my head a lot THANK YOU @Zeka! ? Just to note that u also need getPage() method in your module. class MyModule extends Process implements WirePageEditor { public function getPage() { return $this->page; } } Link to comment Share on other sites More sharing options...
Zeka Posted September 18, 2019 Share Posted September 18, 2019 2 hours ago, lokomotivan said: In this case i loose ability to deactivate the page for some languages but for now i can live with it. Creating a custom add new page is also an option, /module-manager/new/, and writing a custom form for adding new pages and handle it manually. But for page edit is not so easy You don't have to write custom module, you can use ProcessPageEdit as process for that page and omit executeEdit method in your process module. 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