¡Hola, amigos! I’m Señor FAQ, the mustached maestro of questions and answers! With my trusty glasses and a book of endless wisdom, I turn dudas into solutions. Soy el héroe de los curiosos and the champion of clarity.
Hooks are a powerful feature of the JScms, allowing developers to extend and modify its functionality without altering the core code. They provide predefined points in the system where custom logic or features can be injected dynamically.
Hooks are essentially placeholders in the JScms code where custom functions, known as callbacks, can be executed. They enable flexibility and modularity by allowing plugins and extensions to interact with the core system seamlessly.
DynamicHooks::addHook()
method.To register a callback to a hook, use the following method:
DynamicHooks::addHook('hook_name', function($param1, $param2) { // Custom logic here }, 'unique_namespace', 10);
Parameters:
To execute a hook, use the following method:
DynamicHooks::executeHook('hook_name', false, $param1, $param2);
This method executes all callbacks registered to the specified hook. Additional parameters can be passed to the callbacks.
The JScms comes with several predefined hooks for various stages of execution. For example:
before_render
- Executed before the template and editor are loaded.after_save
- Triggered after saving content.user_login
- Fired when a user logs in.Find all hooks described in details in the FAQ hooks category
If you're unsure how to use hooks or encounter issues, refer to the documentation or contact support.