I´m currently developing on moodle and when developing I realized that I don´t hava a clear idea about callback functions and event api, somebody can tell me what are the diferences between them.
From here: https://docs.moodle.org/dev/Callbacks
- Event observers. Each plugin can implement event observers that execute code when event is triggered. See Events API about how to listen to events. Event observers can not always substitute callbacks because they do not return any value and can only happen in case of event. Many "hook points" are necessary before something has happened or when nothing is happening at all, for example a report/summary is gathered. However if it is possible to achieve the desired outcome with event observer, Moodle will not accept requests for adding a "hook point".
So if I needed to use a new callback function how Can I do ??
I haven´t used observers and event API yet ... but I see it´s very similar to events in any other programming lenguage.