MSP01 Posted April 21, 2022 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?
Robin S Posted April 22, 2022 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
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