Events and Packages
Permalink
Hey all!
Not sure how to do this, but i need it ;)
How can i install an event via a package, like in the site_events.php,
Thanks in Advanced ;)
Not sure how to do this, but i need it ;)
How can i install an event via a package, like in the site_events.php,
Thanks in Advanced ;)
Cool thanks, thats what i thought just wantsn't sure, are you sure its the on_start function though?
yup
you only need that in versions less than 5.4
Sweet! I didn't know that (obviously).
Do you know how this works? Are events always on by default, or is there some check for if a package added an event or not?
Thanks!
-Jordan
Do you know how this works? Are events always on by default, or is there some check for if a package added an event or not?
Thanks!
-Jordan
i think they are always on by default, its not like its resource consuming, it just fires a function each time Event::Fire is triggered,
You only need to define ENABLE_APPLICATION_EVENTS to true in config/site.php if you plan on using config/site_events.php to store custom events. You don't need to enable it there if you want to use events defined in a package's on_start() function. Package developers should never need to include it or turn it on.
oh, ok that makes sense
Do I use this functionality if I want to add a 'on_page_save' event using a package?
I'd like to trigger the 'on_page_save' event when a user saves Page Defaults of any page type (Dashboard > Pages & Themes > Page Types > Defaults).
I'd like to trigger the 'on_page_save' event when a user saves Page Defaults of any page type (Dashboard > Pages & Themes > Page Types > Defaults).
yes, if you look in the Howto's section I just wrote up how to add your own.
I'm looking to create an Add-On that will extend an dashboard page. Would this (or similar code) work to extend a core dashboard page? Or are the events only fired for front-end pages?
yes, its used throughout c5
greets
ron