Events in Kohan, where to post them

I am trying to understand the event system in Kohan. The only thing I don't understand is where to place the :: add event code.

It must be in the location where it runs before any events are fired. Or am I missing something?

What I want to achieve is create a class that is available everywhere but don't want to hack it into Kohana.

Can anyone light this up?

+1


source to share


2 answers


Try adding a hook with Event :: Add code.

From the documentation:



The power of the hooks mainly comes from the Events class. Hooks are loaded before any of the events start, so you can attach a hook event to it

+2


source


Usually Event :: add () and Event :: replace () are placed in the Hook constructor. Hooks are loaded before the first system event ("system.ready"), so you can add your own callback for each system or custom event.



0


source







All Articles