Events

Events allow you to predefine one or more callback functions to be executed later on in the application flow. They're handled by the CoreEvent class and are used primarily by the bootstrap, the models and the display. They can, of course, be used anywhere else as well.

Bootstrap

The bootstrap uses bootstrap.prerun, bootstrap.preinit, bootstrap.postinit and bootstrap.postrun events which are generally tied into with hooks.

Models

Models use events for pre-load, post-load, pre-save, post-save, pre-delete, post-delete, pre-destroy and post-destroy actions. Generally these events are defined in the constructor or a function called from the constructor. Model helpers that use CoreModelHelper also use events. To register a model event it must also include the model's event key so events don't get mixed up between models.

AppEvent::register($this->strEventKey . '.pre-save', array($this, 'setDefaults'));

Display

The CoreDisplay class uses display.pre-headers and display.pre-output events in the output() method to allow the application to run any final pre-output processing such as running a find and replace on the page contents.

Controllers

The CoreController class uses the controller.displaynode event in the displayNode() method to register a function that will only load the node data if the node cache wasn't found.