cryostar Posted August 7, 2021 Posted August 7, 2021 I have a custom admin page which uses a ProcessPageLister module. I was already able to enable adding and modifying bookmarks by creating an ___executeEditBookmark() function on my admin module. The only thing left is to view said bookmark in the same Lister. What I noticed is that the "View" link contains an additional path which appears to be the token for said bookmark (so it's /my-admin-module/somerandomtokenstring). How do I catch this one? When I click on the View link it shows an "unrecognized path" error. Thank you for the help! ?
Robin S Posted August 8, 2021 Posted August 8, 2021 (edited) 10 hours ago, cryostar said: I have a custom admin page which uses a ProcessPageLister module. When you say "uses", do you mean your module extends ProcessPageLister? If not that would probably be the simplest approach because then bookmarks will work out-of-the-box. Here's a bare-bones example: <?php namespace ProcessWire; class ProcessListerExtend extends ProcessPageLister { /** * Module information */ public static function getModuleinfo() { return array( 'title' => 'Lister Extend', 'summary' => 'An example of a module that extends ProcessPageLister', 'version' => '0.1.0', 'author' => 'Robin S', 'icon' => 'search-plus', 'requires' => 'ProcessWire>=3.0.0, PHP>=5.4.0', 'page' => array( 'name' => 'lister-extend', 'title' => 'Lister Extend', 'parent' => 'setup', ), 'useNavJSON' => true, ); } /** * Init * * Load the CSS and JS assets for ProcessPageLister rather than needing to duplicate them in this module's folder */ public function init() { $this->wire()->modules->loadModuleFileAssets('ProcessPageLister'); parent::init(); } /** * Install * * Call Process::install() to automatically create the admin page for the process on install * This is needed here because ProcessPageLister overrides with an empty install() method */ public function ___install() { Process::___install(); } /** * Uninstall * * Call Process::uninstall to automatically removes the admin page for the process on uninstall * This is needed here because ProcessPageLister overrides with an empty uninstall() method */ public function ___uninstall() { Process::___uninstall(); } } Wherever you need to modify a method of ProcessPageLister you can create a corresponding method in your module to override it, and you can make use of parent::methodName() within your method if you just want to add something to the ProcessPageLister method. Edited August 8, 2021 by Robin S Simplifies the module by calling the grandparent Process methods directly.
cryostar Posted August 8, 2021 Author Posted August 8, 2021 By “uses” I meant on my custom admin page I have an ___execute() method which gets the ProcessPageLister and renders it. My problem is I cannot seem to view the bookmark because the path is not recognized by my admin page (it directs me to /my-custom-admin-page/sometokenstringherefromlister). I’m not sure how extending the lister would help in my custom admin page on recognizing a random string as its path. Thank you for the help still, though. ?
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