MSP01 Posted April 21, 2022 Share Posted April 21, 2022 I'm trying to make a simple module to help handling some specific pages. There's a simple dashboard and under that a page with ProcessPageLister, like the simplified example below. public function ___execute() { // Dashboard } public function ___executeBrowser() { // Browser $browser = $this->modules->get('ProcessPageLister'); return $browser->execute(); } Problem is when you use the pagination ProcessPageLister creates, you end up in Dashboard instead of staying inside the "Browser". What should I do to make this work correctly? Link to comment Share on other sites More sharing options...
Robin S Posted April 22, 2022 Share Posted April 22, 2022 16 hours ago, MSP01 said: What should I do to make this work correctly? You can set the base URL for MarkupPagerNav that is used for the Lister pagination. public function ___executeBrowser() { // Before MarkupPagerNav is rendered $this->addHookBefore('MarkupPagerNav::render', function(HookEvent $event) { $pager = $event->object; // Set base URL to the current page + URL segment $pager->setBaseUrl($this->wire()->page->url . 'browser/'); }); $browser = $this->modules->get('ProcessPageLister'); return $browser->execute(); } 1 Link to comment Share on other sites More sharing options...
MSP01 Posted April 22, 2022 Author Share Posted April 22, 2022 Thanks Robin, that worked perfectly. 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