MarkE Posted January 20, 2019 Share Posted January 20, 2019 Is it possible (in a custom module) to supply a variable to a lister page? My custom module ("ProcessReports") simply lists a number of reports (mostly lister bookmarks). Some of these bookmarks have a filter using a date comparison and I want the module to supply a date (based on the current date) before displaying the lister, rather than the user having to change it each time. Link to comment Share on other sites More sharing options...
Robin S Posted January 20, 2019 Share Posted January 20, 2019 Check out the PLUs (Page Lister URLs) module. Or if you want to go the hook route try manipulating the defaultSelector property of the Lister: $wire->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) { // Only for the initial load, not for subsequent user changes if($event->config->ajax) return; $lister = $event->object; // Do something here to identify if this is the lister you want to modify and return early if not // Then manipulate the defaultSelector property... // E.g. append to the existing defaultSelector $lister->defaultSelector .= ', your_field=your_value'; }); 3 Link to comment Share on other sites More sharing options...
MarkE Posted January 20, 2019 Author Share Posted January 20, 2019 Thanks. Very helpful. In fact, I’m thinking of going for listerpro now, especially for the page actions. Is this hookable in a similar fashion? Link to comment Share on other sites More sharing options...
Robin S Posted January 20, 2019 Share Posted January 20, 2019 21 minutes ago, MarkE said: Is this hookable in a similar fashion? Yes. The Lister Pro class extends ProcessPageLister. 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